Open initialneil opened 1 year ago
Thanks a lot for your great work @initialneil ! Now that PyTorch 2.0 is out, I'm starting to review your code. I will try it locally on a Windows computer, and we will also try to setup a Windows CI before making the merge. I will add a few comments/questions in the code: if you have time to answer them, that would be fantastic. Otherwise, we should still be able to manage.
@jeanfeydy No problems. I'm happy to help. Thanks for the great work.
I have just tried this code with VS2022 and although the setup scripts run without issue, running the test results in the following rather unhelpful error. This is with python 3.10 on Windows 11.
[KeOps] Generating code for formula Sum_Reduction((Var(0,3,0)-Var(1,3,1))|(Var(0,3,0)-Var(1,3,1)),1) ... Traceback (most recent call last):
File "D:\windows_sdks\keops\test\test_keopscore.py", line 15, in <module>
pykeops.test_numpy_bindings()
File "d:\windows_sdks\keops\pykeops\pykeops\numpy\test_install.py", line 20, in test_numpy_bindings
if np.allclose(my_conv(x, y).flatten(), expected_res):
File "d:\windows_sdks\keops\pykeops\pykeops\numpy\generic\generic_red.py", line 303, in __call__
self.myconv = keops_binder["nvrtc" if tagCPUGPU else "cpp"](
File "d:\windows_sdks\keops\keopscore\keopscore\utils\Cache.py", line 68, in __call__
obj = self.cls(*args)
File "d:\windows_sdks\keops\pykeops\pykeops\common\keops_io\LoadKeOps_nvrtc.py", line 15, in __init__
super().__init__(*args, fast_init=fast_init)
File "d:\windows_sdks\keops\pykeops\pykeops\common\keops_io\LoadKeOps.py", line 18, in __init__
self.init(*args)
File "d:\windows_sdks\keops\pykeops\pykeops\common\keops_io\LoadKeOps.py", line 125, in init
) = get_keops_dll(
File "d:\windows_sdks\keops\keopscore\keopscore\utils\Cache.py", line 27, in __call__
self.library[str_id] = self.fun(*args)
File "d:\windows_sdks\keops\keopscore\keopscore\get_keops_dll.py", line 124, in get_keops_dll_impl
res = map_reduce_obj.get_dll_and_params()
File "d:\windows_sdks\keops\keopscore\keopscore\binders\LinkCompile.py", line 101, in get_dll_and_params
self.generate_code()
File "d:\windows_sdks\keops\keopscore\keopscore\binders\nvrtc\Gpu_link_compile.py", line 74, in generate_code
self.my_c_dll.Compile(
OSError: [WinError -529697949] Windows Error 0xe06d7363
@adam-hartshorne
Gpu_link_compile.py, line 74
is to use nvrtc_jit.dll
to compile the needed file JIT. Can you check the nvrtc_jit.dll
exist?
Post the print result from the test file would help.
print('libcuda =', get_compiler_library('libcuda')) print('libnvrtc =', get_compiler_library('libnvrtc')) print('libcudart =', get_compiler_library('libcudart'))
[KeOps] Warning : There were warnings or errors compiling formula :
CUDA_CUDART_LIBRARY = C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/lib/x64/cudart.lib
CUDA_LIBRARIES = C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/lib/x64/cudart_static.lib
CUDA_TOOLKIT_ROOT_DIR = C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7
set nvrtc path = C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/lib/x64
pybind11_INCLUDE_DIRS = C:/Users/Adam/anaconda3/envs/pytorch/Lib/site-packages/pybind11-2.10.4-py3.10.egg/pybind11/include;C:/Users/Adam/anaconda3/envs/pytorch/Include
PYTHON_LIBRARY = C:/Users/Adam/anaconda3/envs/pytorch/libs/python310.lib
OK
libcuda = nvcuda
libnvrtc = nvrtc-builtins64_117
libcudart = cudart64_110
<CDLL 'C:\Users\Adam\.cache\keops2.1.1\Windows_AdamPC_10_p3.10.10\nvrtc_jit.dll', handle 7ff80b4b0000 at 0x1915099d4b0>
Windows 11, VS2022, Python 3.9, Cuda 11.6
OK
[KeOps] Generating code for formula Sum_Reduction((Var(0,3,0)-Var(1,3,1))|(Var(0,3,0)-Var(1,3,1)),1) ... OK
[KeOps] error: cuMemcpyDtoH(out, (CUdeviceptr) out_d, sizeof(TYPE) * sizeout) failed with error CUDA_ERROR_INVALID_VALUE
Traceback (most recent call last):
File "D:\Downloads\keops-main\keops-main\test\test_keopscore.py", line 15, in <module>
pykeops.test_numpy_bindings()
File "D:\Downloads\keops-main\keops-main\pykeops\pykeops\numpy\test_install.py", line 20, in test_numpy_bindings
if np.allclose(my_conv(x, y).flatten(), expected_res):
File "D:\Downloads\keops-main\keops-main\pykeops\pykeops\numpy\generic\generic_red.py", line 347, in __call__
out = self.myconv.genred_numpy(-1, ranges, nx, ny, nbatchdims, out, *args)
File "D:\Downloads\keops-main\keops-main\pykeops\pykeops\common\keops_io\LoadKeOps.py", line 230, in genred
self.call_keops(nx, ny)
File "D:\Downloads\keops-main\keops-main\pykeops\pykeops\common\keops_io\LoadKeOps_nvrtc.py", line 42, in call_keops
self.launch_keops(
RuntimeError: [KeOps] Cuda error.
However, the GeomLoss I need works.
Hi guys and thank you very much for your great job!
I would be really eager to try keops on my windows computer, but I am stuck on the following
Problem: No way for me to find the vcvars64.bat file for VS Code. Would you have a suggestion for me? Maybe a smart way to look for it?
Thank you very much!
Hi guys and thank you very much for your great job!
I would be really eager to try keops on my windows computer, but I am stuck on the following
Problem: No way for me to find the vcvars64.bat file for VS Code. Would you have a suggestion for me? Maybe a smart way to look for it?
Thank you very much!
@TanCari Hi, the vcvars64.bat file come with Visual Studio, not VSCode.
I tried the above method to configure Keops on Windows, but encountered some problems. My torch information, cuda information and problems are as follows:
python test_keopscore.py I have the same problem. Have you solved it?
The original code manually call gcc to compile the code JIT. I've changed the compiling tool to cmake+ninja on windows. All changes are wrapped with
os.name == 'nt'
to be compatible.To use the code:
VCVARS64
to thevcvars64.bat
file of your Visual Studio. Must do, because there's no other way to find your VS. Do not add"
in the variablemake sure
cmake
is available.make sure
pytorch
is available.clone the repo
install
keopscore
andpykeops
. Must usedevelop
mode.cd pykeops python setup.py develop cd ..
cd test python test_keopscore.py