{"id":6157,"date":"2022-06-16T09:55:08","date_gmt":"2022-06-16T06:55:08","guid":{"rendered":"https:\/\/hpc-education.unn.ru\/?page_id=6157"},"modified":"2022-06-16T16:11:19","modified_gmt":"2022-06-16T13:11:19","slug":"%d1%80%d0%b0%d1%81%d0%bf%d1%80%d0%b5%d0%b4%d0%b5%d0%bb%d0%b5%d0%bd%d0%bd%d0%b0%d1%8f-%d0%bf%d0%b0%d0%bc%d1%8f%d1%82%d1%8c-cuda-%d1%80%d0%b0%d0%b7%d0%b4%d0%b5%d0%bb-a100","status":"publish","type":"page","link":"https:\/\/hpc-education.unn.ru\/en\/%d1%80%d0%b5%d1%81%d1%83%d1%80%d1%81%d1%8b\/%d0%b8%d0%bd%d1%81%d1%82%d1%80%d1%83%d0%ba%d1%86%d0%b8%d1%8f\/%d1%80%d0%b0%d1%81%d0%bf%d1%80%d0%b5%d0%b4%d0%b5%d0%bb%d0%b5%d0%bd%d0%bd%d0%b0%d1%8f-%d0%bf%d0%b0%d0%bc%d1%8f%d1%82%d1%8c-cuda-%d1%80%d0%b0%d0%b7%d0%b4%d0%b5%d0%bb-a100","title":{"rendered":"\u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u0438 NVIDIA A100 (\u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f CUDA) \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 &#8220;a100&#8221;"},"content":{"rendered":"<h2>\u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C\/\u0421++<\/h2>\n<p>C\u0431\u043e\u0440\u043a\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u0438 NVidia A100, \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 CUDA Toolkit \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 10.0.&nbsp; \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443 \u043d\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0432\u0435\u0440\u0441\u0438\u0438 11.2 \u0438 11.3, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u043c\u043e\u0434\u0443\u043b\u0438 cuda\/cuda-11.2 \u0438\u043b\u0438 cuda\/cuda-11.3:<\/p>\n<pre>user@master ~$ module load cuda\/cuda-11.2 # \u0438\u043b\u0438\r\nuser@master ~$ module load cuda\/cuda-11.3<\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435-CUDA \u043c\u043e\u0434\u0443\u043b\u0438 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 MPI, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0438\u043b\u0438 MPI-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u043a\u043e\u0434 CUDA, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<pre>user@master ~$ echo '#include &lt;stdio.h&gt;\r\n#include &lt;cuda.h&gt;\r\n__global__ void mykernel(void){\r\n    printf(\"Hello World from thread %d block %d on device\\n\", threadIdx.x , blockIdx.x);\r\n}\r\nint main (void ) {\r\n    mykernel&lt;&lt;&lt;2,2&gt;&gt;&gt;();\r\n    cudaDeviceSynchronize();\r\n    return 0;\r\n}' &gt;helloCUDA.cu\r\nuser@master ~$ nvcc -o helloCUDA --gpu-architecture=sm_80 -lcudart helloCUDA.cu<\/pre>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c Slurm<\/h2>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0443\u0437\u043b\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 (\u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u0438 NVidia A100 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0443\u0437\u043b\u0430\u0445 node238 \u0438 node239) \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<pre>user@master ~$ srun -N 1 -n 3 -p a100 --gres=gpu:3 .\/helloCUDA\r\nHello World from thread 0 block 1 on device\r\nHello World from thread 1 block 1 on device\r\nHello World from thread 0 block 0 on device\r\nHello World from thread 1 block 0 on device\r\nHello World from thread 0 block 0 on device\r\nHello World from thread 1 block 0 on device\r\nHello World from thread 0 block 1 on device\r\nHello World from thread 1 block 1 on device\r\nHello World from thread 0 block 1 on device\r\nHello World from thread 1 block 1 on device\r\nHello World from thread 0 block 0 on device\r\nHello World from thread 1 block 0 on device<\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c &#8220;-N 1&#8221; &#8211; \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430, &#8220;-n 3&#8221; &#8211; \u0447\u0438\u0441\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 mpi-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c), &#8220;-p a100&#8221; &#8211; \u0432\u044b\u0431\u043e\u0440 \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 \u0443\u0437\u043b\u0430\u0445 \u0441 A100), &#8220;&#8211;gres=gpu:3&#8221; &#8211; \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 3 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u0435\u0439 NVidia A100 (\u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 0,1,2).<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c 3 \u043a\u043e\u043f\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0432\u0441\u0435 \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043e\u0434\u043d\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (\u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043a\u043e\u0434 \u0432\u044b\u0437\u043e\u0432 cudaSetDevice()), \u043a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043f\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043a\u043e\u0434 \u0432 2 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e 2 \u043f\u043e\u0442\u043e\u043a\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439:<\/p>\n<pre>user@master ~$ echo '#!\/bin\/sh\r\n#SBATCH -N 1\r\n#SBATCH --gres=gpu:3\r\n#SBATCH --time=10\r\n#SBATCH --partition=a100\r\n.\/helloCUDA' &gt;batch_helloCUDA.sh\r\nuser@master ~$ sbatch batch_helloCUDA.sh\r\nSubmitted batch job 2420539<\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0437\u0430\u0434\u0430\u043d\u0438\u044f (time, partition, N etc) \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u0430\u043a \u0432 \u0444\u0430\u0439\u043b\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 sbatch. \u041d\u043e\u043c\u0435\u0440 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u044b slurm-JOBID.out \u0438&nbsp;slurm-JOBID.err (\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c\u0438).<\/p>\n<pre>user@master ~$ scontrol show job 2420539\r\nJobId=2420539 JobName=batch_helloCUDA.sh\r\nUserId=user(userid) GroupId=Users(10000) MCS_label=N\/A\r\nPriority=1052937772 Nice=0 Account=user QOS=normal\r\nJobState=PENDING Reason=Nodes_required_for_job_are_DOWN,_DRAINED_or_reserved_for_jobs_in_higher_priority_partitions Dependency=(null)\r\n...\r\nuser@master ~$ cat slurm-2420539.out\r\nHello World from thread 0 block 1 on device\r\nHello World from thread 1 block 1 on device\r\nHello World from thread 0 block 0 on device\r\nHello World from thread 1 block 0 on device<\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c CUDA, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u0435\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0435.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C\/\u0421++ C\u0431\u043e\u0440\u043a\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u0438 NVidia A100, \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 CUDA Toolkit \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 10.0.&nbsp; \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443 \u043d\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0432\u0435\u0440\u0441\u0438\u0438 11.2 \u0438 11.3, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u043c\u043e\u0434\u0443\u043b\u0438 cuda\/cuda-11.2 \u0438\u043b\u0438 cuda\/cuda-11.3: &hellip; <a href=\"https:\/\/hpc-education.unn.ru\/en\/%d1%80%d0%b5%d1%81%d1%83%d1%80%d1%81%d1%8b\/%d0%b8%d0%bd%d1%81%d1%82%d1%80%d1%83%d0%ba%d1%86%d0%b8%d1%8f\/%d1%80%d0%b0%d1%81%d0%bf%d1%80%d0%b5%d0%b4%d0%b5%d0%bb%d0%b5%d0%bd%d0%bd%d0%b0%d1%8f-%d0%bf%d0%b0%d0%bc%d1%8f%d1%82%d1%8c-cuda-%d1%80%d0%b0%d0%b7%d0%b4%d0%b5%d0%bb-a100\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":40,"featured_media":0,"parent":6126,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0},"_links":{"self":[{"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/pages\/6157"}],"collection":[{"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/comments?post=6157"}],"version-history":[{"count":2,"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/pages\/6157\/revisions"}],"predecessor-version":[{"id":6172,"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/pages\/6157\/revisions\/6172"}],"up":[{"embeddable":true,"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/pages\/6126"}],"wp:attachment":[{"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/media?parent=6157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}