Mavenized JCuda

I’ve create Maven project, that have all jar dependencies + so files. They’re copied into target/lib so, after that main class could be run easily and without any setup stuff. Enjoy!

Link to the project - https://github.com/MysterionRise/mavenized-jcuda - you could fork it and write your own JCuda code easily.

My next steps add to local repo all native library for windows, 32 bit linux, etc.

Will appreciate your comments and/or pull requests on GitHub

(EDIT by Marco13: Updated the Link)

Hello

Thanks for this contribution! I also considered “Mavenizing” JCuda, but … I did this with JOCL, and it seemed like a hassle: Properly managing the dependency to the native library seemed to be difficult - and compiling the library was out of the scope of Maven anyhow.

(BTW: A while ago, there has been a similar effort ( https://github.com/sybila/jcuda-maven ) but that was obviously only a first attempt)

However, declaring the dependency to the precompiled libraries seems like a feasible approach. The alternative would be the same that I finally used for JOCL, namely to put all the native libraries into the JAR and extract them at runtime. But considering the large number of native libs for JCuda, and the fact that their versions exactly have to match the version of the installed CUDA version, I doubt that this is practically applicable, so I have not seriously tried this for JCuda yet.

I’ll give this repo a try on some windows machine on monday. For now, I only quickly looked over the POM, and have one question: The user will probably be able to choose the string for <libJ.version>linux-x86_64</libJ.version> manually. But is there also a way to detect and set this at runtime, although it is located in the main <properties> tag?

In any case, thanks again for your efforts!
Marco

Yeah, I see your project. It looks a bit out-of-date. Probably we could collaborate to create super parent project for JCuda.

To give you a try on windows machine, I need to add windows versions of native libs (I’m going to do it in a few days)

And finally, about runtime detection. Sound like a really good idea. I guess, I could do this, with usage of some maven plugin. Let me try it later today.

Konstantin.

Also, could you answer me, which versions of JCuda is more popular? Does it make sense to use JCuda for Cuda 4.0, etc.?

I’m thinking about creating several repos in pom, to handle different versions of Cuda + libs for all available arch + that detection option we talking about

What do you think?

I’m not entirely sure what you mean by “popular”. At the moment, there is something that I consider as an important issue (but it is hard to alleviate this problem) : Namely that someone who wants to use JCuda has to use the JCuda version that matches the version of the CUDA toolkit that he has installed. So if someone has CUDA 5.5, then he will need JCuda 0.5.5, and e.g. JCuda 0.5.0 will most likely not work in all cases. (A “release”/distribution could include the native JCuda libraries and the matching CUDA libraries, but this does hardly make sense for a developer). I think that most developers who use JCuda/CUDA will use the most recent version that is available. There is simply no reason for someone to install CUDA 4.0 today. Throughout the time, such a repository could “accumulate” the version history. But if your question aimed at that: I think it will not be worth the effort to fill the repo with older JCuda versions now.

You understand me correct. Thanks for your patience :slight_smile:

I just update the project with full set of env versions in repo. I need community help to find bugs, etc. Especially at Windows env, since I don’t have it. Follow README

Enjoy!

OK, this worked smoothly after setting
<dllJ.version>windows-x86**_64**</dllJ.version>
in the POM ::manklatsch

I think it should be possible to detect this automatically. I did some experiments for that when I mavenized JOCL, but … I’m a total Maven n00b :o and it became obsolete when I packed the natives into the JAR. But maybe something like the “profile” stuff mentioned at http://stackoverflow.com/questions/6762271/how-to-use-platform-architecture-in-maven-to-determine-dependency can be helfpul here.

I’ve just pushed new changes. With auto detection of os version. It works on 64 bit Unix and probably should work on everything else. But once again I need help with that.

Marco, could you check it?

Thanks,

Yes, runs out-of-the-box here on Win64 ::manklatsch I can test it on Win32 later, but think there should be not much difference.

I think I’ll put a link to that onto the website. When someone already has a maven project, this could come in handy…

Awesome. Anyway, it would be awesome if you check. I’m worry about architecture naming, so would be perfect if you check.

Also, what about plans to create binaries for Mac OS X?

And once again, could you rename this thread? (I think somebody could be distracted cause of Linux-x86_64 naming)

UPD. Since you want to add link to my project, I’m obviously need to rename it to something more informative.

UPD2. It look more nice to me now. https://github.com/MysterionRise/mavenized-jcuda

Works on Win32 as well.

For the MacOS binaries, I have to rely on contibutions from others. For previous versions, the binaries have nearly always be provided by someone, but for version 5.5, nobody has assembled them for MacOS yet…

BTW: I updated the title, and the links in this thread to point to the new repo

Ok. I see. Is it hard to compile them on Mac Os? I could grab my friend Mac to do that.

Thanks for help. Now it looks like a good start for a novice in JCuda.
Do you think about adding it to jcuda.org site? For example here - http://www.jcuda.org/tutorial/TutorialIndex.html ?

*** Edit ***

Hm. Does it required to have Nvidia card to able compile that libs?

It should not be hard to compile it on Mac (although I have not done it myself yet). Using CMake, it should be rather easy. I could only guess why nobody has contributed the MacOS libs for the latest version yet.
And strictly speaking, one does not need an NVIDIA card to compile the libraries, but of course, one will have to install CUDA (for the header files and libraries), so … someone with an AMD card will most likely not want to do that :wink:
I’ll add the link to the website soon, I’ll have to check a few more things first.

Oh, I see. Most of Macbooks are with Intel HD now. So, I guess this is the reason, why there isn’t any libs for Cuda 5.5

Might be true. The iMacs still seem to have NVIDIA cards, but I guess the MacBooks are more common.

Hi,

Is there some problem with parent proejct? How validation is going so far?

No problem, I have just added the link to the main page (as a “News” entry), and at top of the “Downloads” section. I think there it will be most recognizable.

Thank you,

I guess this project could help to use JCuda.

I release massive update of mavenized JCuda with support of 0.5.0 and 0.6.0RC versions of JCuda.

Marco, could you test 0.6.0RC?
The only thing you should do - is to set property in pom.xml <jcuda.version>0.5.5</jcuda.version> to 0.6.0RC