一、学习ubuntu
![](https://img-blog.csdnimg.cn/img_convert/07b6a232a54e652bca88897e058c820a.png)
2.1修改权限
![](https://img-blog.csdnimg.cn/img_convert/d237ea69c22905e5e56737bb7c75bf2f.png)
linux指令学习
cd course //进入course目录
ls //列出文件夹
clean //清屏幕
//---修改权限
chmod go+w text //给text文件夹添加可写权限
chmod g+w make.ip
chmod 755 text 可读可写可执行(user goup other)
pwd //查看绝对路径
cat //查看文件内容 cat text.txt
more //查看文件内容 分行,分页查看
touch //新建文件
mkdir //新建目录
rm text.txt
rmdir text //删除空目录
rm -rf //递归删除文件
cp text.txt try //复制text.txt到try目录
mv text.txt try //移动文件
find /name 1.txt //在name目录下查找文件
grep aaa 1.txt //在txt中查找字段
df -h //查看磁盘使用情况
df -h text.txt
ps //查看进程
kill //终止进程
make file基本介绍和编写规则
目标文件: 依赖文件
命令
![](https://img-blog.csdnimg.cn/img_convert/67deff8998dab2f86184b0d9bf374d1c.png)
![](https://img-blog.csdnimg.cn/img_convert/ed6200d486f4eb70fb0daa2ab18fbb04.png)
//makefile文件
CC = gcc
test: test.c
gcc test.c -o test
main : main.c max.o max.c
$(CC) main.c max.o min.o -o main
二、学习cuda
![](https://img-blog.csdnimg.cn/img_convert/55134feea942f9642bb6d96cb0469a1a.png)
![](https://img-blog.csdnimg.cn/img_convert/5d8feef24e285968ced9897d2f4e5d22.png)
![](https://img-blog.csdnimg.cn/img_convert/12ba88cb7b65d54c5d4d7472fc169b06.png)
三、
![](https://img-blog.csdnimg.cn/img_convert/a93ed98a6a8400befb39da14384ab505.png)
![](https://img-blog.csdnimg.cn/img_convert/790d6147ae20fca30b3e4cd38aa55753.png)
![](https://img-blog.csdnimg.cn/img_convert/95979b362de342c41c030c3997da893d.png)
还有些PPT没有截下来
三、编程
#include <stdio>
__global__ void hello_from_gpu()
{
print("Hello world\n");
}
int main(void)
{
hello_from_gpu<<<1, 1>>> (); //线程
cudaDeviceSyunchonize(); //等待GPU执行完
return 0;
}
编译:
nvcc hello_cuda.cu -o hello_cuda -run
//用makefile来编译,首先编写makefie 文件
//makefile 这是makefile文件
TEST_SOURCE = hello_cuda.cu
TARGEBIN := ./hello_cuda
CC = /usr/local/cuda/bin/nvcc
$(TARGEBIN) : $(TEST_SOURCE)
$(CC) $(TEST_SOURCE) -o $(TARGEBIN)
.PHONT:clean
clean:
-rm -rf $(TARGEBIN)
-rm -rf *.o
运行指令
!make
再运行
!./hello_cuda
尝试多个文件协同编译,修改makefile
//makefile 这是makefile文件
TEST_SOURCE = hello_cuda_01.cu
TARGEBIN := ./hello_cuda_multi_file
CC = nvcc
$(TARGEBIN) : hello_cuda02 -test.cu hello_from_gpu.o
$(CC) $(TEST_SOURCE) hello_from_gpu.o -o $(TARGEBIN)
hello_from_gpu.o:hello_from_gpu.cu
$(CC) --device -c hello_from_gpu.cu -o hello_from_gpu.o
.PHONT:clean
clean:
-rm -rf $(TARGEBIN)
-rm -rf *.o
再运行指令
!make -f Makedile_multi_file
!./hello_cuda_multi_file
!make -f Makefile_Multi_file clean