Need for JCuda 0.4.2 binaries for linux

Hai everyone,
I’m working in the field of Hadoop and Cuda programming. I have to use cuda programs in the map reduce phase of hadoop. I have installed hadoop and CUDA version 4.2 successfully and correctly. I have downloaded JCuda binaries of version 0.4.1 for linux since the 0.4.2 version for linux is not available. now i have the error stating the mismatch of versions of CUDA and JCuda binaries. So please publish the 0.4.2 version of JCuda binaries or mail me up. It will be helpful for me to proceed with my project work. Thanks in advance.

Hello

I assume that you are using a 64bit Linux. Unfortunately, I don’t have access to a 64bit Linux PC, so I have to rely on ontributions from others.

If you have CMake, it should not be too difficult to compile the binaries from the source code. (There may be some hassle with CUDPP, but in doubt, it may be omitted). If you don’t have CMake, I could try to generate and provide the makefiles.

Sorry for inconveniences.

bye
Marco

Hai Macro13,
I’m using 32bit linux Operating System. I don’t have any CMake. i’m new to the field of Jcuda. So it will be very helpful for me if you provide the makefiles and say the steps that i should follow with the makefiles to get the binaries. thanks for your concern.

What exact error are you getting? I used the 32bit binaries with 4.2 and Hadoop just fine… there were very little changes from 4.1 to 4.2 if I recall.

@Ross: If you are only using the Runtime API (mainly JCufft) then different versions might work. (It basically depends on whether the entry points of the functions of the underlying CUDA library have changed or not). But for example, the driver API will most likely not work with different versions.

(I see that I urgently have to make this more flexible, but at the moment, I’m stuck with trying to do this for JOCL and MacOS, which I can’t test either…)

I occasionally have access to a 32bit Linux machine. I’ll try to build the 32bit binaries as soon as possible.

Hello

I have compiled the binaries for JCuda on 32bit Linux, for CUDA 4.2 (build 9). They are available now at http://jcuda.org/downloads/downloads.html

Since the PC which I’m using for the compilation does not have a CUDA-capable card, I could only compile (but not test) the libraries. I’d be grateful to hear whether they work as expected.

bye
Marco

Hello sir, this is the error which we get when we compile the sample code…

Error while loading native library “JCudaDriver-linux-x86” with base name “JCudaDriver”
Operating system name: Linux
Failed to access field ‘Width’
Architecture : i386
Architecture bit size: 32
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name ‘/lib/libJCudaDriver-linux-x86.so’

plz help…so that we can proceed…

What the… :confused:

„Failed to access field ‚Width‘“ means that is unable to access a public field from the Java Classes. It can actually only be a field from the Array Descriptors, but they should all exist, and I’ve never seen this error message before…

Can you post the whole Stack Trace? (It’s huge, but hopefully contains some more information)

I’ll once more verify the access to the fields, but cannot imagine what might be wrong there. IF I find out what may be wrong, I might be able to compile an updated version this weekend.

bye

According to the statements made there, it might be possible to use the JCuda 0.4.1 binaries with the CUDA 4.2 when using ‘LD_PRELOAD’, described in http://forum.byte-welt.de/showthread.php?t=4038 - It might at least be worth a try.

RT,

I got a similar error while running Hadoop, you have to copy the .so files for your architecture into hadoop/lib/native/your-architecture-folder into every datanode.

run:
Error while loading native library “JCudaDriver-linux-x86” with base name “JCudaDriver”
Operating system name: Linux
Architecture : i386
Architecture bit size: 32
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name ‘/lib/libJCudaDriver-linux-x86.so’
Failed to access field ‘Width’
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:151)
at jcuda.LibUtils.loadLibrary(LibUtils.java:83)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:206)
at helloworld.KernelLauncherMatrixMult.main(KernelLauncherMatrixMult.java:38)
Stack trace from the attempt to load the library as a file:
java.lang.NoSuchFieldError: Width
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at jcuda.LibUtils.loadLibrary(LibUtils.java:94)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:206)
at helloworld.KernelLauncherMatrixMult.main(KernelLauncherMatrixMult.java:38)

Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load the native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:129)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:206)
at helloworld.KernelLauncherMatrixMult.main(KernelLauncherMatrixMult.java:38)
Java Result: 1

When we ran the JCUDA sample program to add vectors in netbeans, we get the following error

Error while loading native library “JCudaDriver-linux-x86” with base name “JCudaDriver”
Operating system name: Linux
Architecture : i386
Architecture bit size: 32
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name ‘/lib/libJCudaDriver-linux-x86.so’
Failed to access field ‘Width’
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:151)
at jcuda.LibUtils.loadLibrary(LibUtils.java:83)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:206)
at helloworld.MatrixInvert.init(MatrixInvert.java:62)
at helloworld.MatrixInvert.invert(MatrixInvert.java:124)
at helloworld.MatrixInvertSample.main(MatrixInvertSample.java:42)
Stack trace from the attempt to load the library as a file:
java.lang.NoSuchFieldError: Width
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at jcuda.LibUtils.loadLibrary(LibUtils.java:94)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:206)
at helloworld.MatrixInvert.init(MatrixInvert.java:62)
at helloworld.MatrixInvert.invert(MatrixInvert.java:124)
at helloworld.MatrixInvertSample.main(MatrixInvertSample.java:42)

Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load the native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:129)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:206)
at helloworld.MatrixInvert.init(MatrixInvert.java:62)
at helloworld.MatrixInvert.invert(MatrixInvert.java:124)
at helloworld.MatrixInvertSample.main(MatrixInvertSample.java:42)
Java Result: 1

waiting for ur help…

Actually the link describes the exact problem which we deal with. But sir, can you help to preload a file in Netbeans. we are working in netbeans and we don’t know how to preload that file in it.

Sorry, I’m not sure how to set the Environment variables in Netbeans - maybe something like http://forums.netbeans.org/topic7579.html might help?

I have an idea why it says „Failed to access field ‚Width‘“. I’ll build updated binaries this weekend, and upload them on sunday or monday. Maybe this already solves the problem (it’s a pity that I can not test this, because the Linux32 system I’m using does not have a CUDA-capable card :frowning: ).

RTHI, to add the files to Netbeans, you have to add “java.library.path” to your JVM options, with the path pointing to the folder on your system with all the .so files. A simple Google search will give you all the details.

It seems to find the library. The message
Failed to access field ‚Width‘
is printed from the native side. But I’m still not sure why it is printed. I might have compiled the library with the wrong Toolkit on the Linux32 machine, I’ll verify this. But even then I don’t see a reason why it should fail to access a field of a Java class… :confused:

Hello

I’m just on the Linux32 machine, and checked this again: The library has been compiled with the appropriate toolkit. However, I cannot install the latest drivers and really test it.

But I cannot imagine why this should be related to the native library directly. It finds the native library, and tries to load it, but fails because it cannot access a field from a java class.

So let’s go one step back: What happens if you set up a minimum test project from the command line (as described in http://forum.byte-welt.net/showthread.php?t=2972 , “Setting up a minimum JCuda test project”) ?

IF this works, what happens if you use this test program instead:

import jcuda.*;
import jcuda.driver.*;

public class JCudaRuntimeTest // Actually a Driver API test...
{
    public static void main(String args[])
    {
        JCudaDriver.cuInit(0);
        CUdevice device = new CUdevice();
        cuDeviceGet(device, 0);
        CUcontext context = new CUcontext();
        cuCtxCreate(context, 0, device);

        CUdeviceptr pointer = new CUdeviceptr();
        JCudaDriver.cuMemAlloc(pointer, 4);
    }
}

Minimum test project runs without any errors. But if i execute the program which u gave, the same error comes…
Here is some part of the error

Error while loading native library “JCudaDriver-linux-x86” with base name “JCudaDriver”
Operating system name: Linux
Architecture : i386
Architecture bit size: 32
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name ‘/lib/libJCudaDriver-linux-x86.so’
Failed to access field ‘Width’

I simply have no idea what might be wrong there. The jcuda-0.4.2.jar file contains the CUDA_ARRAY_DESCRIPTOR and CUDA_ARRAY3D_DESCRIPTOR classes, and they contain the ‘Width’ field, and I can’t see any reason why they should not be found.

Did you previously have a different version of CUDA or JCuda installed?

You might try uninstalling the CUDA 4.2 toolkit, and installing the CUDA 4.1 toolkit and test it together with JCuda 0.4.1, because the Linux32 libraries for this version had been compiled by someone who also had a CUDA-capable Linux32 PC and thus could really test them. But this is just a guess, I don’t know any other way to find the reason for this error at the moment.

Sorry for the inconveniences.

By the way: You might alternatively try to compile the binaries on your target machine. With CMake (and omitting CUDPP) this should be rather easy. As long as I don’t know the actual reason for the error, I can not say whether this may solve the problem, but it might be worth a try.