In C + +, you can use the runtime API to create a primary context, which allows multiple threads to enjoy more, avoiding the time overhead of creating multiple standard context using the drive API.
In Java, too, an attempt was made to create a primary context using the runtime API, but the problem was that the discovery was not applicable to Java, and the primary context created in one thread could not be used in another thread.
So, finally, there are multiple standard context created using the driver API
Attention:
In the example given in Jcuda, Java-to-cuda interfaces are used with the driver API. How do I find the runtime API?
Look at the source code of Jcuda Https://github.com/jcuda/jcuda/blob/master/JCudaRuntimeJNI/src/JCudaRuntime.cpp
Find the corresponding Java port function according to the source code
In fact: Jcuda is a link between Java and cuda on the basis of JNI.
Because each Java port function invokes a JNI function, Cuda is called in the JNI function.
Java (program)-Java (interface class, its function member is interface), JNI function (JNI interface), C + + (call Cuda)
See Jcuda source code to understand.
Jcuda Thread Context Test