{"id":6162,"date":"2022-06-16T15:13:17","date_gmt":"2022-06-16T12:13:17","guid":{"rendered":"https:\/\/hpc-education.unn.ru\/?page_id=6162"},"modified":"2022-06-16T16:12:34","modified_gmt":"2022-06-16T13:12:34","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-gpu","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-gpu","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 Tesla M2090 (\u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f CUDA) \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 &#8220;gpu&#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>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u0435\u0439 NVidia Tesla M2090 (Compute Capability 2.0) \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 CUDA Toolkit \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u0438 6.0, 6.5, 7.0, 7.5, 8.0. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\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\u0439 \u043c\u043e\u0434\u0443\u043b\u044c:<\/p>\n<pre>user@master ~$ module load cuda\/cuda-6.0 # \u0438\u043b\u0438\r\nuser@master ~$ module load cuda\/cuda-7.5 # \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439<\/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_sm20 --gpu-architecture=sm_20 -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 Tesla M2090 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0443\u0437\u043b\u0430\u0445 node1-node90) \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 -p gpu .\/helloCUDA_sm20\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;-p gpu&#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).<\/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 --time=10\r\n#SBATCH --partition=gpu\r\n.\/helloCUDA_sm20' &gt;batch_helloCUDA_sm20.sh\r\nuser@master ~$ sbatch batch_helloCUDA_sm20.sh\r\nSubmitted batch job 2420644<\/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 (N, time, partition \u0438 \u0442.\u0434.) \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 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 2420644\r\nJobId=2420644 JobName=batch_helloCUDA_sm20.sh\r\nUserId=user(userid) GroupId=Users(10000) MCS_label=N\/A\r\nPriority=1057677109 Nice=0 Account=user QOS=normal\r\nJobState=COMPLETED Reason=None Dependency=(null)\r\n...\r\nuser@master ~$ cat slurm-2420644.out\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<\/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. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\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++ \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u0435\u0439 NVidia Tesla M2090 (Compute Capability 2.0) \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 CUDA Toolkit \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u0438 6.0, 6.5, 7.0, 7.5, 8.0. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e &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-gpu\">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\/6162"}],"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=6162"}],"version-history":[{"count":2,"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/pages\/6162\/revisions"}],"predecessor-version":[{"id":6173,"href":"https:\/\/hpc-education.unn.ru\/en\/wp-json\/wp\/v2\/pages\/6162\/revisions\/6173"}],"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=6162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}