Exemple #1
0
bool initNative(JNIEnv *env, jobject &handle, cusolverDnHandle_t &handle_native, bool fill)
{
    if (fill)
    {
        handle_native = (cusolverDnHandle_t)getNativePointerValue(env, handle);
    }
    return true;
}
Exemple #2
0
bool initNative(JNIEnv *env, jobject &stream, cudaStream_t &stream_native, bool fill)
{
    if (fill)
    {
        stream_native = (cudaStream_t)getNativePointerValue(env, stream);
    }
    return true;
}
Exemple #3
0
/*
 * Class:     jcuda_jcufft_JCufft
 * Method:    cufftSetStreamNative
 * Signature: (Ljcuda/jcufft/cufftHandle;Ljcuda/runtime/cudaStream_t;)I
 */
JNIEXPORT jint JNICALL Java_jcuda_jcufft_JCufft_cufftSetStreamNative
  (JNIEnv *env, jclass cla, jobject handle, jobject stream)
{
    if (handle == NULL)
    {
        ThrowByName(env, "java/lang/NullPointerException", "Parameter 'handle' is null for cufftSetStream");
        return JCUFFT_INTERNAL_ERROR;
    }
    if (stream == NULL)
    {
        ThrowByName(env, "java/lang/NullPointerException", "Parameter 'stream' is null for cufftSetStream");
        return JCUFFT_INTERNAL_ERROR;
    }

    Logger::log(LOG_TRACE, "Executing cufftSetStream\n");

    cufftHandle nativePlan = env->GetIntField(handle, cufftHandle_plan);
    cudaStream_t nativeStream = NULL;
    nativeStream = (cudaStream_t)getNativePointerValue(env, stream);

    cufftResult result = cufftSetStream(nativePlan, nativeStream);
    return result;
}