Thursday, May 26, 2016

How to Run CUDA on Mac

I have a mid-2010 mac mini, which is equipped with NVIDIA's GeForce 320m integrated graphics chip. Although the official list of CUDA-supported devices does not include GeForce 320m, this chip indeed supports CUDA.

To install CUDA driver and toolkit, download the toolkit for Mac OS X platform from NVIDIA's website. Note that I tried installing toolkit v7.5, but it did not work. The older version v6.0 worked fine, so you probably want to download it instead. After download, simply install it on the system. You will notice that, however, it runs very well until you reboot your system.

In order to fix this issue, you will need to do the following:

1. If you are running El Capitan, disable OS X's System Integrity Protection (SIP). See the instructions here.

2. The following instruction was provided by canemacchina from here. I am reproducing it below.

Create /System/Library/LaunchDaemons/com.nvidia.cuda.launchd.plist file with the content

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.nvidia.cuda.launchd</string>
        <key>ProgramArguments</key>
        <array>
                <string>/sbin/kextload</string>
                <string>/System/Library/Extensions/CUDA.kext</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
<key>UserName</key>
        <string>root</string>
</dict>
</plist>

Next, set the owner of the file
$ sudo chown 0:0 /System/Library/LaunchDaemons/com.nvidia.cuda.launchd.plist

Finally enable the daemons
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.nvidia.cuda.launchd.plist

That's it. Now you will be able to run CUDA on your old Mac.

No comments:

Post a Comment