Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: we must count the actual number of cuda devices #109

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -626,17 +626,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 @@ -716,10 +705,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
Loading