Utilize the NVIDIA GPU in your older iMac for enhanced computational tasks
Background
For iMacs produced in late 2013 (full specification here), they are equipped with a CUDA-enabled NVIDIA GeForce GT 750M graphics card. However in macOS Cataline (10.15.7, which is the latest version of macOS that can be installed on the iMac), no matter which NVIDIA driver and CUDA Toolkit is installed in the system, the CUDA functions will always return this error:
CUDA driver version is insufficient for CUDA runtime version
Although the GPU has very limited computation power (742.7 GFLOPS on FP32, 30.94 GFLOPS on FP64), we should not waste such power, right? The Intel Quad-core i5 2.7GHz CPU that is equipped on the iMac has only 60.4544 GFLOPS.
Since Apple and NVIDIA are no longer friends anymore, NVIDIA does not have a fix for this old discontinued iMac.
Prerequisites
- Apple iMac (late 2013 model)
- 8GB+ USB thumb drive
- Your patience
Solution
Let’s jump to the solution directly.
To solve this problem, we must first switch the operating system to Ubuntu, which provides much better driver support, as NVIDIA is always a friend of Linux.
WARNING: this solution will erase the macOS and all the files permanently.
Step 1: Prepare Ubuntu USB
Installing Ubuntu on the iMac is not difficult at all. You can follow the instructions in this official guide to prepare a bootable Ubuntu USB; you can prepare the USB drive on the same iMac or any other computer (not limited to macOS).
Step 2: Install Ubuntu 24.04 LTS
Once the USB is done, switch off the iMac. Plug in the USB, and power on the iMac while holding the Option key until you see a boot menu. Select the yellow item “EFI Boot” in the menu, then select “Try or install Ubuntu” on the next menu.
Step 3: Install the correct drivers and CUDA Toolkit
This step is crucial, as the driver and CUDA Toolkit version will directly affect the usability of your GPU. Install the following packages AFTER you have updated the system. To update the system software using the Terminal (can be found in the lower left corner menu):
sudo apt update
sudo apt upgrade
The first command is to update the software list from the Ubuntu server to see if any new version is available, while the latter is to upgrade the installed software.
Then, we are going to install the NVIDIA driver. For the NVIDIA GeForce GT 750M graphics card, the driver version must be version 470, otherwise the card cannot be detected.
sudo apt install nvidia-driver-470
Then, let’s install CUDA Toolkit (version 12 Update 2):
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda-repo-ubuntu2204-12-2-local_12.2.2-535.104.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-12-2-local_12.2.2-535.104.05-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda
If the above commands can be executed without errors, it means that your NVIDIA GPU card is ready to use. Try to execute this command to see the status of the card:
nvidia-smi
It should display the status of your NVIDIA graphics card, including utilization rate, GPU memory usage, temperature, etc.
If you encounter problems, please leave a message below.