About Nvidia's MPs execution

Source: Internet
Author: User

MPs ' implementation: Main reading manual, Https://docs.nvidia.com/deploy/pdf/CUDA_Multi_Process_Service_Overview.pdf

Here's the command I need:

Start Mps-control

Export Cuda_visible_devices=0

Export Cuda_mps_pipe_directory=/tmp/nvidia-mps

Export Cuda_mps_log_directory=/tmp/nvidia-log

Nvidia-cuda-mps-control-d

Close Mps-control

echo Quit | Nvidia-cuda-mps-control

When you're done, you can view the log file.

The procedure for verifying MPs from this link

Http://stackoverflow.com/questions/34709749/how-do-i-use-nvidia-multi-process-service-mps-to-run-multiple-non-mpi-cuda-app

$ cat T1034.cu#include<stdio.h>#include<stdlib.h>#defineMax_delay 30#defineCudacheckerrors (msg) Do{cudaerror_t __err=Cudagetlasterror (); if(__err! =cudasuccess) {fprintf (stderr,"Fatal Error:%s (%s at%s:%d) \ n", MSG, cudageterrorstring (__err), __file__, __line__); fprintf (stderr,"* * * failed-aborting\n"); Exit (1); }   }  while(0) #include<time.h>#include<sys/time.h>#defineUsecpsec 1000000ULLunsignedLong LongDtime_usec (unsignedLong Longstart)  {Timeval TV; Gettimeofday (&AMP;TV,0); return((TV.TV_SEC*USECPSEC) +tv.tv_usec)-start;}#defineApprx_clks_per_sec 1000000000ULL__global__voidDelay_kernel (unsigned seconds) {unsignedLong LongDT =clock64 ();  while(Clock64 () < (DT + (seconds*APPRX_CLKS_PER_SEC))) ;}intMainintargcChar*argv[]) {unsigned delay_t=5;//seconds, approximatelyunsigned delay_t_r; if(Argc >1) Delay_t_r = Atoi (argv[1]); if((Delay_t_r >0) && (Delay_t_r < max_delay)) delay_t =Delay_t_r; unsignedLong LongDifft = Dtime_usec (0); Delay_kernel<<<1,1>>>(delay_t);  Cudadevicesynchronize (); Cudacheckerrors ("Kernel fail"); Difft=dtime_usec (DIFFT); printf ("kernel Duration:%fs\n", difft/(float) usecpsec); return 0;} $ NVCC-arch=sm_35-o t1034 t1034.cu$./T1034kernel Duration:6. 528574s$

$ cat start_as_root.bash#!/bin/bash# The following must be performed with root Privilegeexport cuda_visible_ DEVICES="0"nvidia-smi-i 0-C exclusive_processnvidia- Cuda-mps-control-d
$ cat mps_run#!/bin/bash. /t1034 &. /t1034$

$ cat stop_as_root.bash#!/bin/| nvidia-cuda-mps-controlnvidia2 -c default$

$./6. 078304s$
$./Start_as_root.bash$. /66. 263062s

About Nvidia's MPs execution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.