CUDA and CUBLAS initialization using MAGMA

Open discussion for MAGMA

CUDA and CUBLAS initialization using MAGMA

Postby jgpallero » Wed Mar 21, 2012 7:30 am

Hello:

In the files in testing directory of MAGMA can I see that before to use the functions the macro TESTING_CUDA_INIT() is called. This macro is defined in testings.h as
Code: Select all
#define TESTING_CUDA_INIT()                                                \
  CUdevice  dev;                                                        \
  CUcontext context;                                                        \
  if( CUDA_SUCCESS != cuInit( 0 ) ) {                                        \
    fprintf(stderr, "CUDA: Not initialized\n" ); exit(-1);                \
  }                                                                        \
  if( CUDA_SUCCESS != cuDeviceGet( &dev, 0 ) ) {                        \
    fprintf(stderr, "CUDA: Cannot get the device\n"); exit(-1);                \
  }                                                                        \
  if( CUDA_SUCCESS != cuCtxCreate( &context, 0, dev ) ) {                \
    fprintf(stderr, "CUDA: Cannot create the context\n"); exit(-1);        \
  }                                                                        \
  if( CUBLAS_STATUS_SUCCESS != cublasInit( ) ) {                        \
    fprintf(stderr, "CUBLAS: Not initialized\n"); exit(-1);                \
  }                                                                        \
  printout_devices( );

My question is, is mandatory to initialize CUDA for use MAGMA or could only CUBLAS initialized as
Code: Select all
if( CUBLAS_STATUS_SUCCESS != cublasInit( ) ) {                        \
    fprintf(stderr, "CUBLAS: Not initialized\n"); exit(-1);                \
  }   

??

Thanks
jgpallero
 
Posts: 29
Joined: Tue Nov 15, 2011 12:38 pm

Re: CUDA and CUBLAS initialization using MAGMA

Postby mgates3 » Fri May 04, 2012 6:35 pm

Yes, we currently recommend initializing as in the testings.h file. At the moment, a number of MAGMA functions call the CUDA driver API (functions starting with cu instead of cuda). cuInit() and cuCtxCreate() must be called before calling the CUDA driver API. In a future release, MAGMA's use of these functions will likely disappear.
-mark
mgates3
 
Posts: 442
Joined: Fri Jan 06, 2012 2:13 pm

Re: CUDA and CUBLAS initialization using MAGMA

Postby mgates3 » Wed Sep 05, 2012 4:58 pm

In MAGMA 1.2.1, the driver routines were eliminated from MAGMA, so the initialization is simpler now. Just call cublasInit(). This is reflected in the testings.h file.
-mark
mgates3
 
Posts: 442
Joined: Fri Jan 06, 2012 2:13 pm


Return to User discussion

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests