jcuda / jcuda-main

Summarizes the main JCuda libraries
MIT License
99 stars 20 forks source link

Building JCuda on a machine with no Nvidia hardware #23

Closed blueberry closed 5 years ago

blueberry commented 6 years ago

Is it possible to build and release JCuda on a machine that has no CUDA-capable hardware?

I would like to help with building JCuda for macOS, but my old MacBook Air does not have an Nvidia GPU.

I have googled some inconclusive information. I guess that if this was possible, I would have to change the build process a bit regarding tests that can't pass. I am not sure whether some sort of headers and build & pray are viable?

jcuda commented 6 years ago

It should be possible, although admittedly, I cannot remember ever having tried it.

What it needs for the compilation are basically the headers and some .lib files for linking. (Not sure whether they are also called .lib on Mac). In order to work smoothly, there will likely some settings that have to be made (similar to PATH entries on Windows). These settings and the proper target directories for the header/lib files are usually handled by the installer. It should be possible to install the CUDA SDK even when no NVIDIA hardware is available. During the installation, it will try to install the NVIDIA Drivers, but think that it will skip this step if there is no matching hardware.

However, I see that this may be a burden, and a bit annoying: Having to install a beast like the CUDA SDK only to compile some binary may be an unreasonable effort, particularly when the resulting binaries cannot properly be tested.

I still hope that @nakul02 can provide the binaries (he did so for version 0.8.0), or that another contributor jumps in here.

EDIT: A side note: Of course, one can simply pass -DskipTests=true to the Maven call to skip the unit tests (and this may sometimes be reasonable when there is some path lookup hassle), but it should at least somehow be verified that the resulting libraries can be loaded at all...

nakul02 commented 6 years ago

I built the 0.8.0 binary on a friend's older 2014 iMac that shipped with NVidia card. Right now I am traveling and cant access his machine, but I'll try to compile a binary and send it to you when I am back.

blueberry commented 6 years ago

@nakul02 Can you give an estimate on when you'd be able to do the build? Thank you for taking time to help with this.

nakul02 commented 6 years ago

@blueberry - the situation kind of sucks. I am back from my travels, but now my friend with the iMac is travelling. I will look around to see if I can get hold of another older iMac/MacBook Pro with an NVidia card on it.

blueberry commented 6 years ago

Thank you.

jcuda commented 6 years ago

So after all, it is even possible to build the (Linux) binaries on a Virtual Machine. During the build, one has to pass -DskipTests=true to Maven, and afterwards verify that the resulting binaries work, but technically it's possible. So I think that this issue can be closed.

blueberry commented 6 years ago

The (still unsolved) issue was related to macOS builds though.

jcuda commented 6 years ago

Yes, but I think that when it even works on a VM with Linux, I would be surprised if there was a problem with compiling them on Mac even when there is no CUDA-capable hardware.

A caveat could be that the installers (if there is something like this on Mac...) may have some hiccups. At least on Windows, the installer is by default also installing the drivers. This step might fail when there is no matching hardware. But even if this step fails, I think that the libraries and headers that are required for building the CUDA-based libraries should then still be available.

blueberry commented 6 years ago

Cool. I'll download the latest CUDA and will try to install it on my old MacBook Air and see how it goes. I don't see a 0.9.1 release of JCuda. Should I build from the master?

jcuda commented 6 years ago

Should I build from the master?

Not yet. I'm still hoping for feedback of whether the updated 0.9.0b Maven Version (mentioned in https://github.com/jcuda/jcuda-main/issues/24#issuecomment-377695655 ) works on a Linux+CUDA9 machine. If it does work, I can finally do the update to 9.1...

jcuda commented 5 years ago

From what I understood from the previous releases (10.0 and 10.1), it seems to be possible to build the binaries, at least. (I also built the binaries in a Linux VM occasionally, but that's a bit of a hassle).

So unless there are further points to discuss here, I'd close that one.