Skip to content

Commit

Permalink
Merge pull request #109 from abouteiller/bugfix/dtd_gpu
Browse files Browse the repository at this point in the history
bugfix: we must count the actual number of cuda devices
  • Loading branch information
abouteiller authored Jan 31, 2024
2 parents fd1917c + e31ffc5 commit 416aec9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 34 deletions.
9 changes: 9 additions & 0 deletions src/dplasmaaux_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,12 @@ void *dplasma_create_cuda_handles(void *obj, void *_n)

return new;
}

void dplasma_destroy_cuda_handles(void *_h, void *_n)
{
dplasma_cuda_handles_t *handles = (dplasma_cuda_handles_t*)_h;
(void)_n;
cublasDestroy_v2(handles->cublas_handle);
cusolverDnDestroy(handles->cusolverDn_handle);
free(handles);
}
1 change: 1 addition & 0 deletions src/dplasmaaux_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ typedef struct {
} dplasma_cuda_handles_t;

void *dplasma_create_cuda_handles(void *obj, void *user);
void dplasma_destroy_cuda_handles(void *_h, void *_n);

#define DPLASMA_CUBLAS_CHECK_STATUS( STR, STATUS, CODE ) \
do { \
Expand Down
1 change: 1 addition & 0 deletions src/dtd_wrappers/zgemm.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ parsec_core_zgemm_cuda(parsec_device_gpu_module_t* gpu_device,
#endif /* defined(PARSEC_DEBUG_NOISIER) */

handles = parsec_info_get(&gpu_stream->infos, CuHI);
assert(NULL != handles);

parsec_cuda_exec_stream_t* cuda_stream = (parsec_cuda_exec_stream_t*)gpu_stream;
cublasSetStream( handles->cublas_handle, cuda_stream->cuda_stream );
Expand Down
20 changes: 5 additions & 15 deletions tests/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,17 +628,6 @@ char cwd[1024];
int unix_timestamp;
#endif

#if defined(DPLASMA_HAVE_CUDA)
static void destroy_cuda_handles(void *_h, void *_n)
{
dplasma_cuda_handles_t *handles = (dplasma_cuda_handles_t*)_h;
(void)_n;
cublasDestroy_v2(handles->cublas_handle);
cusolverDnDestroy(handles->cusolverDn_handle);
free(handles);
}
#endif

parsec_context_t* setup_parsec(int argc, char **argv, int *iparam)
{
#ifdef PARSEC_PROF_TRACE
Expand Down Expand Up @@ -718,10 +707,11 @@ parsec_context_t* setup_parsec(int argc, char **argv, int *iparam)
}
}
if( nbgpu > 0 ) {
parsec_info_register(&parsec_per_stream_infos, "DPLASMA::CUDA::HANDLES",
destroy_cuda_handles, NULL,
dplasma_create_cuda_handles, NULL,
NULL);
CuHI = parsec_info_register(&parsec_per_stream_infos, "DPLASMA::CUDA::HANDLES",
dplasma_destroy_cuda_handles, NULL,
dplasma_create_cuda_handles, NULL,
NULL);
assert(-1 != CuHI);
}
#endif

Expand Down
15 changes: 0 additions & 15 deletions tests/testing_zgemm_dtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ int main(int argc, char ** argv)
parsec_context_start(parsec);
parsec_task_class_t *zgemm_tc = parsec_dtd_create_zgemm_task_class(dtd_tp, TILE_FULL, PARSEC_DEV_ALL);

#if defined(DPLASMA_HAVE_CUDA)
if( gpus > 0 ){
CuHI = parsec_info_lookup(&parsec_per_stream_infos, "DPLASMA::CUDA::HANDLES", NULL);
assert( CuHI != -1);
}
#endif /* defined(DPLASMA_HAVE_CUDA) */

for( m = 0; m < dcC.super.mt; m++ ) {
tempmm = m == dcC.super.mt-1 ? dcC.super.m-m*dcC.super.mb : dcC.super.mb;
ldcm = BLKLDD(&dcC.super, m);
Expand Down Expand Up @@ -370,14 +363,6 @@ int main(int argc, char ** argv)
parsec_context_start(parsec);
parsec_task_class_t *zgemm_tc = parsec_dtd_create_zgemm_task_class(dtd_tp, TILE_FULL, PARSEC_DEV_ALL);

#if defined(DPLASMA_HAVE_CUDA)
if( gpus > 0 ){
CuHI = parsec_info_lookup(&parsec_per_stream_infos, "DPLASMA::CUDA::HANDLES", NULL);
assert( CuHI != -1);
}
#endif


for( m = 0; m < dcC.super.mt; m++ ) {
tempmm = m == dcC.super.mt-1 ? dcC.super.m-m*dcC.super.mb : dcC.super.mb;
ldcm = BLKLDD(&dcC.super, m);
Expand Down
4 changes: 0 additions & 4 deletions tests/testing_zpotrf_dtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ int main(int argc, char **argv)

#if defined(DPLASMA_HAVE_CUDA)
zpotrf_dtd_workspace_info_t* infos = (zpotrf_dtd_workspace_info_t*) malloc(sizeof(zpotrf_dtd_workspace_info_t));
if( gpus > 0 ){
CuHI = parsec_info_lookup(&parsec_per_stream_infos, "DPLASMA::CUDA::HANDLES", NULL);
assert(CuHI != -1);
}
#endif

if( dplasmaLower == uplo ) {
Expand Down

0 comments on commit 416aec9

Please sign in to comment.