SuiteSparse icon indicating copy to clipboard operation
SuiteSparse copied to clipboard

Fix compilation warnings with GPU support enabled

Open stefanozampini opened this issue 5 years ago • 4 comments

Below is a patch to fix the following compilation warnings

In file included from ../Supernodal/cholmod_super_numeric.c:73:0: ../Supernodal/../GPU/t_cholmod_gpu.c: In function 'r_cholmod_l_gpu_updateC': ../Supernodal/../GPU/t_cholmod_gpu.c:494:33: warning: passing argument 6 of 'createRelativeMapOnDevice' from incompatible pointer type [-Wincompatible-pointer-types] &(Common->gpuStream[iDevBuff]) ); ^ In file included from ../Supernodal/../GPU/t_cholmod_gpu.c:20:0, from ../Supernodal/cholmod_super_numeric.c:73: ../Include/cholmod_gpu_kernels.h:27:5: note: expected 'cudaStream_t {aka struct CUstream_st *}' but argument is of type 'struct CUstream_st **' int createRelativeMapOnDevice ( Int *d_Map, Int *d_Ls, Int *d_RelativeMap, ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../Supernodal/cholmod_super_numeric.c:73:0: ../Supernodal/../GPU/t_cholmod_gpu.c:609:5: warning: implicit declaration of function 'addUpdateOnDevice'; did you mean 'addUpateOnDevice'? [-Wimplicit-function-declaration] addUpdateOnDevice ( gpu_p->d_A[0], devPtrC, ^~~~~~~~~~~~~~~~~ addUpateOnDevice In file included from ../Supernodal/cholmod_super_numeric.c:75:0: ../Supernodal/../GPU/t_cholmod_gpu.c: In function 'c_cholmod_l_gpu_updateC': ../Supernodal/../GPU/t_cholmod_gpu.c:494:33: warning: passing argument 6 of 'createRelativeMapOnDevice' from incompatible pointer type [-Wincompatible-pointer-types] &(Common->gpuStream[iDevBuff]) ); ^ In file included from ../Supernodal/../GPU/t_cholmod_gpu.c:20:0, from ../Supernodal/cholmod_super_numeric.c:73: ../Include/cholmod_gpu_kernels.h:27:5: note: expected 'cudaStream_t {aka struct CUstream_st *}' but argument is of type 'struct CUstream_st **' int createRelativeMapOnDevice ( Int *d_Map, Int *d_Ls, Int *d_RelativeMap, ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../Supernodal/cholmod_super_numeric.c:75:0: ../Supernodal/../GPU/t_cholmod_gpu.c:613:5: warning: implicit declaration of function 'addComplexUpdateOnDevice'; did you mean 'addComplexUpateOnDevice'? [-Wimplicit-function-declaration] addComplexUpdateOnDevice ( gpu_p->d_A[0], devPtrC, ^~~~~~~~~~~~~~~~~~~~~~~~ addComplexUpateOnDevice

diff --git a/CHOLMOD/GPU/t_cholmod_gpu.c b/CHOLMOD/GPU/t_cholmod_gpu.c
index 39a4298..c697340 100644
--- a/CHOLMOD/GPU/t_cholmod_gpu.c
+++ b/CHOLMOD/GPU/t_cholmod_gpu.c
@@ -491,7 +491,7 @@ int TEMPLATE2 (CHOLMOD (gpu_updateC))
                                 (Int *)(gpu_p->d_Ls),
                                 (Int *)(gpu_p->d_RelativeMap),
                                 pdi1, ndrow2,
-                                &(Common->gpuStream[iDevBuff]) );
+                                Common->gpuStream[iDevBuff] );

     /* ---------------------------------------------------------------------- */
     /* do the CUDA SYRK */
@@ -608,11 +608,11 @@ int TEMPLATE2 (CHOLMOD (gpu_updateC))
 #ifdef REAL
     addUpdateOnDevice ( gpu_p->d_A[0], devPtrC,
         gpu_p->d_RelativeMap, ndrow1, ndrow2, nsrow,
-        &(Common->gpuStream[iDevBuff]) );
+        Common->gpuStream[iDevBuff] );
 #else
     addComplexUpdateOnDevice ( gpu_p->d_A[0], devPtrC,
         gpu_p->d_RelativeMap, ndrow1, ndrow2, nsrow,
-        &(Common->gpuStream[iDevBuff]) );
+        Common->gpuStream[iDevBuff] );
 #endif

     /* Record an event indicating that kernels for
diff --git a/CHOLMOD/Include/cholmod_gpu_kernels.h b/CHOLMOD/Include/cholmod_gpu_kernels.h
index ba05f12..fed28a7 100644
--- a/CHOLMOD/Include/cholmod_gpu_kernels.h
+++ b/CHOLMOD/Include/cholmod_gpu_kernels.h
@@ -27,10 +27,10 @@ int createMapOnDevice ( Int *d_Map, Int *d_Ls, Int psi, Int nsrow );
 int createRelativeMapOnDevice ( Int *d_Map, Int *d_Ls, Int *d_RelativeMap,
                            Int pdi1, Int ndrow, cudaStream_t astream );

-int addUpateOnDevice ( double *d_A, double *devPtrC, Int *d_RelativeMap,
+int addUpdateOnDevice ( double *d_A, double *devPtrC, Int *d_RelativeMap,
     Int ndrow1, Int ndrow2, Int nsrow, cudaStream_t astream );

-int addComplexUpateOnDevice ( double *d_A, double *devPtrC, Int *d_RelativeMap,
+int addComplexUpdateOnDevice ( double *d_A, double *devPtrC, Int *d_RelativeMap,
     Int ndrow1, Int ndrow2, Int nsrow, cudaStream_t astream );

 int sumAOnDevice ( double *a1, double *a2, const double alpha, int nsrow,

stefanozampini avatar Nov 17 '19 12:11 stefanozampini

Yet another fix

diff --git a/CHOLMOD/GPU/cholmod_gpu_kernels.cu b/CHOLMOD/GPU/cholmod_gpu_kernels.cu
index 909f98e..74f86a2 100644
--- a/CHOLMOD/GPU/cholmod_gpu_kernels.cu
+++ b/CHOLMOD/GPU/cholmod_gpu_kernels.cu
@@ -100,11 +100,11 @@ extern "C" {

   int createRelativeMapOnDevice ( Int *d_Map, Int *d_Ls,
                                  Int *d_RelativeMap,Int  pdi1,
-                                 Int ndrow, cudaStream_t* astream )
+                                 Int ndrow, cudaStream_t astream )
   {
     unsigned int kgrid = (ndrow+255)/256;
     unsigned int kblock = 256;
-    kernelCreateRelativeMap <<<kgrid, kblock, 0, *astream>>> 
+    kernelCreateRelativeMap <<<kgrid, kblock, 0, astream>>> 
       ( d_Map, d_Ls, d_RelativeMap, pdi1, ndrow);
     return 0;
   }
@@ -114,7 +114,7 @@ extern "C" {
   int addUpdateOnDevice ( double *d_A, double *devPtrC,
                          Int *d_RelativeMap, Int ndrow1,
                          Int ndrow2, Int nsrow,
-                         cudaStream_t* astream )
+                         cudaStream_t astream )
   /* ======================================================================== */
   /* Assemble the Schur complment from a descendant supernode into the current
      supernode */
@@ -130,7 +130,7 @@ extern "C" {
   grids.x = (ndrow2+15)/16;
   grids.y = (ndrow1+15)/16;

-  kernelAddUpdate <<<grids, blocks, 0, *astream>>> 
+  kernelAddUpdate <<<grids, blocks, 0, astream>>> 
     ( d_A, devPtrC, d_RelativeMap, ndrow1, ndrow2, nsrow );

   return 0;
@@ -140,7 +140,7 @@ extern "C" {
   int addComplexUpdateOnDevice ( double *d_A, double *devPtrC,
                                 Int *d_RelativeMap, Int ndrow1,
                                 Int ndrow2, Int nsrow,
-                                cudaStream_t* astream )
+                                cudaStream_t astream )
   /* ======================================================================== */
   /* Assemble the Schur complment from a descendant supernode into the current
      supernode */
@@ -156,7 +156,7 @@ extern "C" {
   grids.x = (ndrow2+15)/16;
   grids.y = (ndrow1+15)/16;

-  kernelAddComplexUpdate <<<grids, blocks, 0, *astream>>> 
+  kernelAddComplexUpdate <<<grids, blocks, 0, astream>>> 
     ( d_A, devPtrC, d_RelativeMap, ndrow1, ndrow2, nsrow );

   return 0;

stefanozampini avatar Nov 19 '19 10:11 stefanozampini

Here is the full patch

cholmod_patch.txt

stefanozampini avatar Nov 19 '19 10:11 stefanozampini

ping @DrTimothyAldenDavis . Anything wrong with my patch?

stefanozampini avatar Dec 16 '19 19:12 stefanozampini

I was out sick for 3 weeks in November ... still getting caught up.

On Mon, Dec 16, 2019 at 1:51 PM Stefano Zampini [email protected] wrote:

ping @DrTimothyAldenDavis https://github.com/DrTimothyAldenDavis . Anything wrong with my patch?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/5?email_source=notifications&email_token=AEYIIOISD7DPXNXE7H43VYDQY7L4TA5CNFSM4JOJQZVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG74ILA#issuecomment-566215724, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYIIOPRJP2EOPJSSDTVQWTQY7L4TANCNFSM4JOJQZVA .

DrTimothyAldenDavis avatar Dec 16 '19 19:12 DrTimothyAldenDavis

Might be still worth applying the patch from Stefano. If you want, I can create a proper merge request to make inclusion easier for you.

gruenich avatar Sep 23 '22 18:09 gruenich

This is now fixed in SuiteSparse 7.4.0, in the default dev branch of the SuiteSparse repo. I'll release a 7.4.0.beta1 soon.

DrTimothyAldenDavis avatar Nov 29 '23 09:11 DrTimothyAldenDavis