jcuda-main icon indicating copy to clipboard operation
jcuda-main copied to clipboard

JCuda with Gradle

Open muliyul opened this issue 3 years ago • 3 comments

Looks like defining the classifier does not work.

        // build.gradle.kts
        val cudaClassifier = "${getOsString()}-${getArchString()}"
	implementation("org.jcuda:jcuda:11.2.0") {
//		exclude("org.jcuda:jcuda-natives:11.2.0")
	}
	implementation("org.jcuda:jcuda-natives:11.2.0:$cudaClassifier")

results in

Could not find jcuda-natives-11.2.0-${jcuda.os}-${jcuda.arch}.jar (org.jcuda:jcuda-natives:11.2.0).

Any ideas?

muliyul avatar Jul 09 '21 16:07 muliyul

It seems to resolve the jcuda.os and jcuda.arch properly and assemble the right file name. But I haven't jused Gradle so extensively yet (as mentioned in the USAGE.md file, the Gradle script was largely taken from https://github.com/jcuda/jcuda-main/issues/16#issuecomment-323610823 ), so I wonder at which point in the build process this error message appears.

(In doubt, I'd try to ping one of the contributors from the linked issue, maybe they can provide further insights...)

jcuda avatar Jul 10 '21 16:07 jcuda

I've solved it with the following:

val cudaClassifier = "${getOsString()}-${getArchString()}"
implementation("org.jcuda:jcuda:11.2.0") {
 isTransitive = false
}
implementation("org.jcuda:jcuda-natives:11.2.0:$cudaClassifier")

In other words - exclude the transitive dependencies and manually include them.

muliyul avatar Jul 11 '21 11:07 muliyul

The compile entries already contain that transitive = false, so I'm not entirely sure where the difference comes into play.

I'll leave this issue open for now. If others confirm that the build file might have to be updated, maybe the update can be derived from the discussion here.

jcuda avatar Jul 13 '21 18:07 jcuda