getkeops / keops

KErnel OPerationS, on CPUs and GPUs, with autodiff and without memory overflows
https://www.kernel-operations.io
MIT License
1.03k stars 65 forks source link

[KeOps] Error : Error compiling formula. #242

Closed gamorosino closed 2 years ago

gamorosino commented 2 years ago

I am trying to use the pykeops library but it fails. In particular, I am using pykeops via the geomloss library, running the example _transferlabels.py. The geomloss author redirected me here to open the issue as it specifically concerns Keops.

I don't know if it is a problem related to the version of cuda and/or nvidia drivers. cudatoolkit: 10.2.89 nvidia driver: 440.118.02

I created a specific environment to run geomloss (as shown in the attachment). environment_py.txt

Thanks in advance

[KeOps] Compiling cuda jit compiler engine ... /home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp: In function 'int Compile(const char*, const char*, int, int, const char*)':
/home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp:66:22: error: 'strdup' was not declared in this scope
   66 |     arch_flag_char = strdup(arch_flag.str().c_str());
      |                      ^~~~~~

[KeOps] Compiling cuda jit compiler engine ... /home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp: In function 'int Compile(const char*, const char*, int, int, const char*)':
/home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp:66:22: error: 'strdup' was not declared in this scope
   66 |     arch_flag_char = strdup(arch_flag.str().c_str());
      |                      ^~~~~~

[KeOps] Compiling cuda jit compiler engine ... /home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp: In function 'int Compile(const char*, const char*, int, int, const char*)':
/home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp:66:22: error: 'strdup' was not declared in this scope
   66 |     arch_flag_char = strdup(arch_flag.str().c_str());
      |                      ^~~~~~

[KeOps] Compiling cuda jit compiler engine ... /home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp: In function 'int Compile(const char*, const char*, int, int, const char*)':
/home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp:66:22: error: 'strdup' was not declared in this scope
   66 |     arch_flag_char = strdup(arch_flag.str().c_str());
      |                      ^~~~~~

Traceback (most recent call last):
  File "transfer_labels.py", line 145, in <module>
    from pykeops.torch.cluster import sort_clusters, cluster_ranges
  File "/home/gamorosino/miniconda3/lib/python3.7/site-packages/pykeops/__init__.py", line 3, in <module>
    import keopscore
  File "/home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/__init__.py", line 34, in <module>
    Gpu_link_compile.compile_jit_compile_dll()
  File "/home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/Gpu_link_compile.py", line 106, in compile_jit_compile_dll
    dllname=jit_compile_dll(),
  File "/home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/utils/misc_utils.py", line 41, in KeOps_OS_Run
    KeOps_Error("Error compiling formula.")
  File "/home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/utils/misc_utils.py", line 28, in KeOps_Error
    raise ValueError(message)
ValueError: [KeOps] Error : Error compiling formula. (error at line 41 in file /home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/utils/misc_utils.py)
bcharlier commented 2 years ago

Hi @gamorosino ,

an explicit include to string.h was missing. It works without it with some compilers though...

Can you confirm that it fix the pb on your side ? To do so, the simplest way is to add #include <string.h> line 12 of your file /home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp

Feel free to reopen the issue, if it does not work ...

b.

gamorosino commented 2 years ago

Hi,

I confirm you that adding #include solve the problem,

Thanks for the help

Gabriele Amorosino

Il giorno lun 2 mag 2022 alle ore 14:31 bcharlier @.***> ha scritto:

Hi @gamorosino https://github.com/gamorosino ,

an explicit include to string.h was missing. It works without it with some compilers though...

Can you confirm that it fix the pb on your side ? To do so, the simplest way is to add #include line 12 of your file /home/gamorosino/miniconda3/lib/python3.7/site-packages/keopscore/binders/nvrtc/nvrtc_jit.cpp

Feel free to reopen the issue, if it does not work ...

b.

— Reply to this email directly, view it on GitHub https://github.com/getkeops/keops/issues/242#issuecomment-1114792973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKMORADRH6E7UNNOZF65GODVH7DIHANCNFSM5USBN4DQ . You are receiving this because you were mentioned.Message ID: @.***>