Jcuda Thread Context Test

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.