Late 2013 13" Macbook Pro Retina + GTX 1070 @ 16Gbps-TB2>TB3 (Aorus Gaming Box) + Ubuntu 18.10
- Model: Late 2013 13" Macbook Pro Retina (A1502)
- CPU: Intel® Core™ i7-4558U @ 2.80GHz × 4
- iGPU: Intel® Iris™ Graphics 5100
- dGPU: None
- OS: macOS Mojave 10.14.1
- eGPU enclosure: Gigabyte Aorus Gaming Box
- Graphics card: Nvidia GTX 1070
- Cables and adapters: Apple Thunderbolt 3 (USB-C) to Thunderbolt 2 Adapter (A1790) + Apple Thunderbolt Cable (A1410). HDMI to HDMI cable for connecting to an external monitor (Dell U2414H).
I followed mostly the instruction in this post and searched for answers whenever I bumped into issues. To be honest, I don't have a clue about what I am doing half of the time and I just try to research into what seems reasonable and successful; so please point out if there is anything that's seriously wrong with what I did so that I can strike-through them and that others can avoid repeating useless steps.
The following steps are what I did to have things up and running, including the steps that I probably should have avoided, or done in a different order, for completeness:
- Using Disk Utility: created a partition of 84 GB for installation In macOS Mojave and formatted as FAT.
- Using Etcher: flashed an image of Ubuntu 18.10 on to a 8 GB USB2 drive.
- Connected the Aorus Gaming Box to power and the Macbook and rebooted while holding onto the option (alt) key.
- Booted from the USB drive created in Step 2 selected Try Ubuntu without installing.
- Opened Terminal once booted and started installation with ubiquity --no-bootloader.
- Followed the installation prompted and under the Updates and other software section, selected the option Install third-party software for graphics and Wi-Fi hardware and additional media formats.
- Continued with the prompt and selected Something else under the Installation type section.
- Highlighted the 84 GB disk, clicked on the - button to "remove" it, and used the free space to create a new partition formatted as ext4 with the mount point being /.
- Followed the rest of the prompt and installed Ubuntu.
- Booted back into macOS, downloaded rEFInd and installed it.
- Rebooted and Ubuntu now showed up in rEFInd.
- Booted into Ubuntu for the first time. Internal display was off by default. Found out that the Nouveau driver was being used for the graphics card.
- Blacklisted the Nouveau driver by following these instructions.
- Removed older Nvidia drivers: sudo apt-get purge nvidia*
- Added the ppa:graphics-drivers repository: sudo add-apt-repository ppa:graphics-drivers
- sudo apt-get update
- sudo apt-get nvidia-driver-410 nvidia-prime
- sudo prime-select nvidia
- Added nvidia-drm.modeset=1 to /etc/default/grub so that relevant line became GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia-drm.modeset=1"
- sudo update-initramfs -u
- Rebooted. Had to do a hard shutdown because it wasn't rebooting (I'm currently still having this issue whenever I attempt to shut down).
- Used the command watch nvidia-smi to verify that the driver is working.
Before installing Ubuntu I actually got the eGPU to work under macOS High Sierra 10.13.6 (I dual booted that on the 84 GB partition that I mentioned above) simply by using purage-wrangler.sh and choosing to install web driver with it. The internal screen was accelerated, and the LEDs and side fans were working. Unfortunately I couldn't get CUDA and cuDNN installed properly for Tensorflow no matter what I tried, so I gave up and went straight to Ubuntu 18.10.
At this point almost everything is working as intended, with the exception that:
- I would really have liked to get the internal screen working, too.
- The RGB LEDs in the Gaming Box are not turning on in Ubuntu. I know they are functional because they do turn on when booted into Mojave; I was also able to change the pattern on a Windows 10 installation that I attempted at one point. It is actually working in my favour because I assume that there wouldn't have been an easy way to turn them off in Ubuntu and it would interfere with sleeping otherwise; the macOS software for fiddling with the lights also don't seem to work in macOS Mojave (doesn't start at all).
- The two small fans on the side are also not turning on in Ubuntu (but would turn on under Mojave), which really concerns me but I don't seem to be able to find anything about it and I don't have the necessary background to figure out how to get them working.
- I wasn't able to flash the firmware by following the instructions in this guide. I just get permission denied when I attempted to do that. I read something about Thunderbolt security mode but I couldn't quickly find a way to change that and so it's on the long list of to-do's for now.
At the time of writing, the GPU has been running with little down time for 3 days doing machine learning, which takes the higher priority now. However, I did take some time in between to try to research into changing the fan speed on the graphics card because I felt that the fan speed under adaptive mode was inadequate (for the tasks that I was doing, the fan was running at approximately 43% while the temperature was around 66–70 °C.
Here are the steps that I took to be able to manually set the speed of the fan on the card:
- I initially attempted the solution in this thread but it wasn't working for me.
- After looking around for a while trying to find a solution, I came across a page (I'm so sorry, I forgot to bookmark it) that indicates I should try adding Option "Coolbits" "4" to the Device section in /etc/X11/xorg.conf.
- After rebooting and opening NVIDIA X Server Settings, a slider for adjusting fan speed appeared under the Thermal Settings section of the graphics card.
As a comparison, I could now set the fan speed to 70%, which would keep the GPU to operate at just below 50 °C for the same tasks as above. The fan noise at 70% is also somewhat acceptable. While I am still concerned that the side fans are not running, increasing the fan speed also helped cooling down the PSU and the board inside that was heating up the front of the Gaming Box—both sides were previously hot to touch without adaptive fan speed.
If I get the time to tinker with it again I will definitely update this post again! If anyone happens to know what I could do to get the fans on the side working, it'll be very much appreciated if you could leave a comment!
I'm not sure if it's me doing something stupid or if things are not supported in Ubuntu 18.10—I just don't seem to be able to get Luxmark and Geekbench 4 working (I downloaded them, did a chmod +x and tired to run them in Terminal, but in the case of Luxmark nothing seems to happen and Geekbench 4 would not work with the --compute flag).
After trying a few things, which didn't work and I've forgotten what they were now, I ended up trying with Unigine because of this thread; using the same settings, here is the result:
Perhaps related to benchmarking is that I definitely saw a dramatic increase in speed with the artificial neural networks that I have been training. With the smallest sets of data it would previously take approxmately 10 seconds per epoch on a Tensorflow build optimised for my CPU, and they are now just under 800 ms. What's even more amazing is that previously the time per epoch was scaling really badly with the size of the input—but it seems to scale differently on a GPU. As an indication, one of the larger sets that I was doing was taking > 45 seconds per epoch on the CPU, but it only takes around 1100 ms per epoch with the GPU.
At the time of writing, it's already been 3 days since I had things up and running (installing CUDA and cuDNN were other nightmares of the journey) and I am still very excited about how much faster things are running now.
At one point I made a mistake because I was stressed and tired and completely corrupted the Mojave partition (the UUID was showing up as just FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF); I somehow managed to rescue that by sifting through as many of the threads on StackOverflow related to the issue.
In any case, I'm glad that I decided to take the plunge and worked through all of it. More importantly, thank you very much to everyone here as well—I'm sure that I would not have attempted any of this and would not have been able to do the work that I am currently involved with otherwise (I just simply can't afford to build a system now, I was very lucky that I got the GPU second-hand at a very affordable price). So... thank you!
I also haven't been able to get Luxmark or Geekbench working either in Linux Mint, but for benchmarking, Phoronix Test Suite has a bunch of other tests you can run.