Commits

Matt Knepley  committed 20e2c33

Sys: Allow CUBLAS init to be turned off
- This causes SEGV on my Air all the time

  • Participants
  • Parent commits 716d056

Comments (0)

Files changed (1)

File src/sys/objects/pinit.c

   }
 
 #if defined(PETSC_HAVE_CUDA)
-  {
+  flg  = PETSC_TRUE;
+  ierr = PetscOptionsGetBool(NULL,"-cublas",&flg,NULL);CHKERRQ(ierr);
+  if (flg) {
     PetscMPIInt p;
     for (p = 0; p < PetscGlobalSize; ++p) {
       if (p == PetscGlobalRank) cublasInit();
       ierr = PetscMallocDumpLog(stdout);CHKERRQ(ierr);
     }
   }
+
+#if defined(PETSC_HAVE_CUDA)
+  flg  = PETSC_TRUE;
+  ierr = PetscOptionsGetBool(NULL,"-cublas",&flg,NULL);CHKERRQ(ierr);
+  if (flg) {
+    PetscInt p;
+    for (p = 0; p < PetscGlobalSize; ++p) {
+      if (p == PetscGlobalRank) cublasShutdown();
+      ierr = MPI_Barrier(PETSC_COMM_WORLD);CHKERRQ(ierr);
+    }
+  }
+#endif
+
   /* Can be destroyed only after all the options are used */
   ierr = PetscOptionsDestroy();CHKERRQ(ierr);
 
   ierr = MPI_Keyval_free(&Petsc_InnerComm_keyval);CHKERRQ(ierr);
   ierr = MPI_Keyval_free(&Petsc_OuterComm_keyval);CHKERRQ(ierr);
 
-#if defined(PETSC_HAVE_CUDA)
-  {
-    PetscInt p;
-    for (p = 0; p < PetscGlobalSize; ++p) {
-      if (p == PetscGlobalRank) cublasShutdown();
-      ierr = MPI_Barrier(PETSC_COMM_WORLD);CHKERRQ(ierr);
-    }
-  }
-#endif
-
   if (PetscBeganMPI) {
 #if defined(PETSC_HAVE_MPI_FINALIZED)
     PetscMPIInt flag;