问题
I am trying to install a luarocks package called stn. The official way of installing it is by running:
luarocks install https://raw.githubusercontent.com/qassemoquab/stnbhwd/master/stnbhwd-scm-1.rockspec
But this gives me the unfortunate, exacerbating error:
nvcc fatal : Value 'sm_20' is not defined for option 'gpu-architecture'
The only way to fix this, to my knowledge, is to manually change the CMakeLists.txt file from:
IF (CUDA_FOUND)
LIST(APPEND CUDA_NVCC_FLAGS "-arch=sm_20")
To:
IF (CUDA_FOUND)
LIST(APPEND CUDA_NVCC_FLAGS "-arch=sm_30")
So that meant I had to clone the repo into a local file, change the CMakeLists file, and then luarock make it. (As a disclaimer, to do this, I had to chown
my entire user because of directory writing permissions luarocks just doesnt seem to have for whatever reason. How screwed am I?).
So, I was able to get it to install the .rockspec file by cding into the master directory and:
luarocks make stnbhwd-scm-1.rockspec
And this gave me this output:
$ luarocks make stnbhwd-scm-1.rockspec
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/tex/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1" && make
-- Found Torch7 in /home/tex/torch/install
-- Compiling with OpenMP support
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tex/Downloads/stnbhwd-master/build
[ 50%] Built target stn
[ 75%] Building NVCC (Device) object CMakeFiles/custn.dir/custn_generated_init.cu.o
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THStorage.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THStorageCopy.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCStorage.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCStorageCopy.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THTensor.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THTensorCopy.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THTensorRandom.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THTensorMath.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THTensorConv.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THTensorLapack.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensor.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorCopy.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorRandom.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMath.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMathBlas.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMathMagma.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMathPairwise.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMathPointwise.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMathReduce.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMathCompare.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMathCompareT.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMathScan.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMasked.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorScatterGather.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorIndex.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorSort.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorMode.h
CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensorTopK.h
[100%] Linking CXX shared module libcustn.so
[100%] Built target custn
cd build && make install
[ 50%] Built target stn
[100%] Built target custn
Install the project...
-- Install configuration: "Release"
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libstn.so
-- Set runtime path of "/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libstn.so" to "$ORIGIN/../lib:/home/tex/torch/install/lib"
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/test.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/AffineGridGeneratorBHWD.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/AffineTransformMatrixGenerator.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/init.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/BilinearSamplerBHWD.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libcustn.so
-- Set runtime path of "/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libcustn.so" to "$ORIGIN/../lib:/home/tex/torch/install/lib"
Warning: /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/init.lua is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/init.lua~~~~~~
Warning: /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/AffineTransformMatrixGenerator.lua is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/AffineTransformMatrixGenerator.lua~~~~~~
Warning: /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/BilinearSamplerBHWD.lua is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/BilinearSamplerBHWD.lua~~~~~~
Warning: /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/test.lua is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/test.lua~~~~~~
Warning: /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/AffineGridGeneratorBHWD.lua is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/AffineGridGeneratorBHWD.lua~~~~~~
Warning: /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libstn.so is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libstn.so~~~~~~
Warning: /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libcustn.so is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libcustn.so~~~~~
stnbhwd scm-1 is now installed in /home/tex/torch/install/ (license: MIT)
Pay attention to the "warning" flags. I don't know why it does that, but I think it has some clear effect on the install, because when I load stn...:
Failed loading module stn in LuaRocks rock stnbhwd scm-1
no field package.preload['stn']
no file '/home/tex/.luarocks/share/lua/5.1/stn.lua'
no file '/home/tex/.luarocks/share/lua/5.1/stn/init.lua'
no file '/home/tex/torch/install/share/lua/5.1/stn.lua'
no file '/home/tex/torch/install/share/lua/5.1/stn/init.lua'
no file './stn.lua'
no file '/home/tex/torch/install/share/luajit-2.1.0-beta1/stn.lua'
no file '/usr/local/share/lua/5.1/stn.lua'
no file '/usr/local/share/lua/5.1/stn/init.lua'
no file '/home/tex/.luarocks/lib/lua/5.1/stn.so'
no file '/home/tex/torch/install/lib/lua/5.1/stn.so'
no file '/home/tex/torch/install/lib/stn.so'
no file './stn.so'
no file '/usr/local/lib/lua/5.1/stn.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
/home/tex/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
run_model.lua:6: in main chunk
[C]: in function 'dofile'
.../tex/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50
sigh Does anyone know a fix? Is there a workaround? LuaRocks still works for installing packages, but maybe I am doing something wrong for installing local packages. Is there a way to install the stn package while changing the cmake file before it installs (instead of downloading the package and manually changing it that way)? I doubt it, but... :(
Edit: anyone reading this, please refer to this page. I essentialy said screw this and uploaded the edited repo onto my own github page. Now, I face a different error.
回答1:
I can see some mismatch in the paths. When you are installing stnbhwd you use prefix:
-DCMAKE_INSTALL_PREFIX="/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1"
but looking to the warnings you get:
Warning: /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/init.lua is not tracked by this installation of LuaRocks
Shows that your LUA_PATH, LUA_CPATH is set to
/home/tex/torch/install/share/lua/5.1
Firstly, try the path that you used in prefix to add into LUA_PATH, LUA_CPATH
If that doesn't help try to specify the path in the Lua script:
-- add a new directory to the path
package.path = package.path .. ";/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/?.lua"
Alos, check this one
回答2:
I have got the same problem with you. And I find out that this is because I have install multi-version lua and during that time installed luarocks. At last i have remove the other lua version and reinstall luarocks, then use luarocks reinstall nn, everything goes well.
来源:https://stackoverflow.com/questions/47665820/warning-file-lua-is-not-tracked-by-this-installation-of-luarocks