Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cutorch doesn't build with the newest cuda. (cudaPointerAttributes) #848

Open
LevitatingBusinessMan opened this issue Feb 10, 2021 · 7 comments

Comments

@LevitatingBusinessMan
Copy link

On this line here: https://github.com/torch/cutorch/blob/master/init.c#L938 cutorch is trying to use a non-existing property of cudaPointerAttributes. This property already went deprecated in Cuda 10.

@LevitatingBusinessMan LevitatingBusinessMan changed the title Cutorch doesn't build with the newest cuda. Cutorch doesn't build with the newest cuda. (cudaPointerAttributes) Feb 10, 2021
@aldenjenkins
Copy link

Do you have a solution for this?

@olahaye74
Copy link

Same problem for me
init.c:938:34: error: 'struct cudaPointerAttributes' has no member named 'isManaged'
lua_pushboolean(L, attributes.isManaged);

@LeducH
Copy link

LeducH commented Sep 16, 2021

I get this error when I want to build and install with arch

[ 94%] Building C object CMakeFiles/cutorch.dir/init.c.o
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/init.c: In function ‘cutorch_isManagedPtr’:
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/init.c:938:34: error: ‘struct cudaPointerAttributes’ has no member named ‘isManaged’
     lua_pushboolean(L, attributes.isManaged);
                                  ^
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/init.c: In function ‘luaopen_libcutorch’:
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/init.c:1033:3: error: implicit declaration of function ‘luaL_setfuncs’; did you mean ‘luaT_setfuncs’? [-Werror=implicit-function-declaration]
   luaL_setfuncs(L, cutorch_stuff__, 0);
   ^~~~~~~~~~~~~
   luaT_setfuncs
cc1: some warnings being treated as errors
make[2]: *** [CMakeFiles/cutorch.dir/build.make:94: CMakeFiles/cutorch.dir/init.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/generic/CStorage.c:35,
                 from generic/CStorage.c:1,
                 from /home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/lib/THC/THCGenerateAllTypes.h:17,
                 from /home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/Storage.c:18:
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/torch/generic/Storage.c: In function ‘torch_CudaByteStorage_init’:
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/torch/generic/Storage.c:276:3: error: implicit declaration of function ‘luaL_setfuncs’; did you mean ‘luaT_setfuncs’? [-Werror=implicit-function-declaration]
   luaL_setfuncs(L, torch_Storage_(_), 0);
   ^~~~~~~~~~~~~
   luaT_setfuncs
In file included from /home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/generic/CTensor.c:8,
                 from generic/CTensor.c:1,
                 from /home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/lib/THC/THCGenerateAllTypes.h:17,
                 from /home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/Tensor.c:20:
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/torch/generic/Tensor.c: In function ‘torch_CudaByteTensor_init’:
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/torch/generic/Tensor.c:1436:3: error: implicit declaration of function ‘luaL_setfuncs’; did you mean ‘luaT_setfuncs’? [-Werror=implicit-function-declaration]
   luaL_setfuncs(L, torch_Tensor_(_), 0);
   ^~~~~~~~~~~~~
   luaT_setfuncs
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/TensorMath.c: In function ‘cutorch_CudaByteTensorMath_init’:
/home/user/Downloads/waifu2x-git/torch7-cutorch-git/src/torch7-cutorch-git/TensorMath.c:10031:3: error: implicit declaration of function ‘luaL_setfuncs’; did you mean ‘luaT_setfuncs’? [-Werror=implicit-function-declaration]
   luaL_setfuncs(L, m_cutorch_CudaByteTensorMath__, 0);
   ^~~~~~~~~~~~~
   luaT_setfuncs
cc1: some warnings being treated as errors
make[2]: *** [CMakeFiles/cutorch.dir/build.make:80: CMakeFiles/cutorch.dir/Storage.c.o] Error 1
cc1: some warnings being treated as errors
make[2]: *** [CMakeFiles/cutorch.dir/build.make:108: CMakeFiles/cutorch.dir/Tensor.c.o] Error 1
cc1: some warnings being treated as errors
make[2]: *** [CMakeFiles/cutorch.dir/build.make:122: CMakeFiles/cutorch.dir/TensorMath.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:117: CMakeFiles/cutorch.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...


@LevitatingBusinessMan
Copy link
Author

Seems like somebody on the ArchLinux user repositories has found a temporary fix.

Replace .isManaged with .type == 3 (cudaMemoryType::cudaMemoryTypeManaged).

@LevitatingBusinessMan
Copy link
Author

I applied a patch to the AUR package, I am not entirely sure if it will work properly in programs using cutorch_isManagedPtr but at least the program compiles again.

https://gist.github.com/LevitatingBusinessMan/0a214c62471999a1d5afbdb732e773a0

@mw66
Copy link

mw66 commented Jan 14, 2022

Seems like somebody on the ArchLinux user repositories has found a temporary fix.

Replace .isManaged with .type == 3 (cudaMemoryType::cudaMemoryTypeManaged).

according to:

nagadomi/distro#11 (comment)

-    lua_pushboolean(L, attributes.isManaged);
+    lua_pushboolean(L, attributes.type == cudaMemoryTypeManaged);

@LevitatingBusinessMan
Copy link
Author

@mw66 Yep that's exactly it. cudaMemoryTypeManaged should be a constant for 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants