Message Boards Message Boards

0
|
6769 Views
|
7 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Why is CUDA so slow on Mathematica 8 on OS X?

Posted 11 years ago
Hi everyone,

I have a new MacBook Pro with the nVidia 650M GPU.  I've been playing with the CUDA examples in Mathematica 8 and I've noticed something.  The first time I ran CUDAQ[], I had to wait until Mathematica downloaded the CUDA resources paclet.  However, subsequent uses of CUDAQ (after I've quit and restarted Mathematica) also take a very long time to return 'True', like it's still downloading something.  I swear it didn't do this before.  Also, many CUDA* commands take a long time to return results.  I've got the latest CUDA driver for Mac installed.  It's very frustrating.  Has anyone else experienced this?  I realize I could also use OpenCL, but I'm curious to track down the issue with CUDA support.  Thanks!

-Sean
POSTED BY: Sean Wall
7 Replies
Posted 11 years ago
Interesting note here - I think I've confirmed my suspicion that this is a bug with Mathematica 8 on a Retina MacBook using the notebook interface.  If I run the CUDAQ[] command either from the command-line using the kernel directly or by running the notebook interface on a non-Retina display (via an external monitor, for example), then the CUDA commands run normally. I need to confirm the second part (running on an external monitor), but I'm pretty sure that's what I was doing when I didn't see the problem.  I have the Home Edition of Mathematica, so I don't know if I can submit a bug report or not to Wolfram.
POSTED BY: Sean Wall
Posted 11 years ago
Here's a final note on this issue.  It seems to be specific to the combination of Mathematica/CUDALink on the Mac.  I've downloaded the CUDA SDK from NVIDIA and built the samples and they all ran great.

Oh well.  I'll just use OpenCLLink then!  ;)
POSTED BY: Sean Wall
Posted 11 years ago
Hi Stefan,

Yes, I've since restarted the kernel many times after installing the paclet, but the delay remains.  I've also tried disabling the automatic graphics switching, but it made no difference.  The only thing I can think of is that my MacBook Pro has the retina display, and perhaps the GPU is tied up for some reason?  This is interesting though - the OpenCL functions seem to work just fine.  It appears to be only CUDA that is affected.  Odd.

Thanks for the suggestions, though.  emoticon

-Sean
POSTED BY: Sean Wall
CUDAResourcesInformation[] is usually pretty slow (about 10 seconds on my machine), although I'm not sure about the precise reason.

CUDAInformation[] should not take long to evaluate, <1 second is normal.

Have you restarted the Mathematica kernel after the paclet was downloaded and installed? CUDA functions might behave in unexpected ways just after the paclet has been installed, before the kernel is restarted.

Another possible issue on MacBook Pro is "Automatic Graphics Switching"
Make sure to uncheck this:
System Preferences -> Energy Saver -> Automatic Graphics Switching

Please let me know if any of this helps.
Posted 11 years ago
Hi folks, thanks for the help!

Here's the result of running the requested commands.  I had already reset my default configs using the KB article mentioned:
 In[1]:= Needs["CUDALink`"]
 
 During evaluation of In[1]:= General::cdir: Cannot set current directory to authserver. >>
 (* What's up with this error? Some Googling revealed this is a common error on the OS X version of Mathematica. *)
 
 In[2]:= CUDAResourcesInformation[]
 
 Out[2]= {{"Name" -> "CUDAResources", "Version" -> "8.0.4.1",
   "BuildNumber" -> -1, "QualifiedName" -> "CUDAResources-OSX-8.0.4.1",
   "Description" -> "{ToolkitVersion -> 4.0, MinimumDriver -> 270.0}",
   "MathematicaVersion" -> "8.0.1+", "SystemIDs" -> {"MacOSX-x86-64"},
   "MainLink" -> "", "Root" -> ".", "Contexts" -> {},
  "Extensions" -> {"Resource"}, "ID" -> "", "Creator" -> "",
  "CreatorURL" -> "", "Publisher" -> "", "SupportContact" -> "",
  "Thumbnail" -> "",
  "Location" ->
   "/Users/sean/Library/Mathematica/Paclets/Repository/CUDAResources-\
OSX-8.0.4.1", "Installed" -> True, "Enabled" -> True,
  "Loading" -> None, "Internal" -> False,
  "Hash" -> "e7af8c48be63c5caca6ddda9dc04f92d"}}

In[3]:= CUDAInformation[]

Out[3]= {1 -> {"Name" -> "GeForce GT 650M", "Clock Rate" -> 900000,
   "Compute Capabilities" -> 3., "GPU Overlap" -> 1,
   "Maximum Block Dimensions" -> {1024, 1024, 64},
   "Maximum Grid Dimensions" -> {2147483647, 65535, 65535},
   "Maximum Threads Per Block" -> 1024,
   "Maximum Shared Memory Per Block" -> 49152,
   "Total Constant Memory" -> 65536, "Warp Size" -> 32,
   "Maximum Pitch" -> 2147483647,
   "Maximum Registers Per Block" -> 65536, "Texture Alignment" -> 512,
    "Multiprocessor Count" -> 2, "Core Count" -> 64,
   "Execution Timeout" -> 1, "Integrated" -> False,
   "Can Map Host Memory" -> True, "Compute Mode" -> "Default",
   "Texture1D Width" -> 65536, "Texture2D Width" -> 65536,
   "Texture2D Height" -> 65536, "Texture3D Width" -> 4096,
   "Texture3D Height" -> 4096, "Texture3D Depth" -> 4096,
   "Texture2D Array Width" -> 16384,
   "Texture2D Array Height" -> 16384,
   "Texture2D Array Slices" -> 2048, "Surface Alignment" -> 512,
   "Concurrent Kernels" -> True, "ECC Enabled" -> False,
   "TCC Enabled" -> False, "Total Memory" -> 1073414144}}
Here's the thing - everything looks good as far as versions and such, and CUDA commands do work, but it took like 10+ seconds for the call toCUDAResourcesInformation[] to return, and over a minute for the call to CUDAInformation[] to come back.  Are those delays normal?
POSTED BY: Sean Wall
Could you please also post
Needs["CUDALink`"];
CUDAInformation[]
This would help diagnose the problem.
What happens when you run CUDAResourcesInformation?
Needs["CUDALink`"]
CUDAResourcesInformation[]
If you haven't tried already, you might consider resetting your copy of Mathematica's configuration to its installation default settings:

http://support.wolfram.com/kb/3274
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract