Clemapfel / jluna

Julia Wrapper for C++ with Focus on Safety, Elegance, and Ease of Use
https://clemens-cords.com/jluna
MIT License
239 stars 12 forks source link

CUDA.jl compatability #66

Open chrhck opened 2 months ago

chrhck commented 2 months ago

When running code that uses CUDA.jl i get a CUDA.CuError(code=CUDA.cudaError_enum(0x00000004), details=CUDA.Optional{String}(data=nothing))

MWE:

#include <jluna.hpp>
using namespace jluna;
int main()
{
    initialize();

    Main.safe_eval(R"(
        using CUDA

        x = CuArray([1]).+1

    )");
    return 0;
}

Using the standard C embedding API, the same code works without issues:

#include <julia.h>
JULIA_DEFINE_FAST_TLS // o

int main(int argc, char *argv[])
{
    jl_init();

    jl_eval_string(R"(
        using CUDA
        x = CuArray([1]).+1
        )");
    jl_atexit_hook(0);
    return 0;
}