[Bf-blender-cvs] [d01964a] opensubdiv-modifier: Fix for assert failure in CUDA when using Nvidia Optimus

Sergey Sharybin noreply at git.blender.org
Wed Jul 2 19:46:52 CEST 2014


Commit: d01964a4ce8129671bb6acdd890511dc5ac20f31
Author: Sergey Sharybin
Date:   Wed Jul 2 17:10:38 2014 +0600
https://developer.blender.org/rBd01964a4ce8129671bb6acdd890511dc5ac20f31

Fix for assert failure in CUDA when using Nvidia Optimus

===================================================================

M	intern/opensubdiv/cudaInit.h

===================================================================

diff --git a/intern/opensubdiv/cudaInit.h b/intern/opensubdiv/cudaInit.h
index 91f73e3..9ae6a14 100644
--- a/intern/opensubdiv/cudaInit.h
+++ b/intern/opensubdiv/cudaInit.h
@@ -132,12 +132,15 @@ static bool HAS_CUDA_VERSION_4_0 () {
 #    endif
         // Need to initialize CUDA here so getting device
         // with the maximum FPLOS works fine.
-        cuda_assert(cuInit(0));
-
-        // This is to deal with cases like NVidia Optimus,
-        // when there might be CUDA library installed but
-        // NVidia card is not being active.
-        if (cutGetMaxGflopsDeviceId() < 0) {
+        if (cuInit(0) == CUDA_SUCCESS) {
+            // This is to deal with cases like NVidia Optimus,
+            // when there might be CUDA library installed but
+            // NVidia card is not being active.
+            if (cutGetMaxGflopsDeviceId() < 0) {
+                cudaLoadSuccess = false;
+            }
+        }
+        else {
             cudaLoadSuccess = false;
         }
     }




More information about the Bf-blender-cvs mailing list