我正在尝试安装名为stn的luarocks包。安装它的官方方式是运行:
luarocks install https://raw.githubusercontent.com/qassemoquab/stnbhwd/master/stnbhwd-scm-1.rockspec
但这给了我一个不幸的,加剧的错误:
nvcc fatal : Value 'sm_20' is not defined for option 'gpu-architecture'
据我所知,解决此问题的唯一方法是手动更改CMakeLists.txt文件:
IF (CUDA_FOUND)
LIST(APPEND CUDA_NVCC_FLAGS "-arch=sm_20")
要:
IF (CUDA_FOUND)
LIST(APPEND CUDA_NVCC_FLAGS "-arch=sm_30")
这意味着我必须将repo克隆到本地文件中,更改CMakeLists文件,然后luarock制作它。 (作为免责声明,要做到这一点,我必须chown
我的整个用户,因为目录写入权限luarocks似乎无论出于何种原因。我怎么搞砸?)。
所以,我能够通过cding到主目录来安装.rockspec文件,并且:
luarocks make stnbhwd-scm-1.rockspec
这给了我这个输出:
$ 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)
注意“警告”标志。我不知道为什么会这样,但我认为它对安装有一些明显的影响,因为当我加载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
叹息有人知道修复吗?有解决方法吗? LuaRocks仍然适用于安装软件包,但也许我在安装本地软件包时出错了。有没有办法在安装之前更改cmake文件时安装stn包(而不是下载包并手动更改它)?我对此表示怀疑,但...... :(
编辑:阅读此内容的任何人,请参阅this page。我essentialy说拧了这个并将编辑后的repo上传到我自己的github页面。现在,我面临着一个不同的错误。
答案 0 :(得分:1)
我可以看到路径中的一些不匹配。当您安装stnbhwd时,请使用前缀:
-DCMAKE_INSTALL_PREFIX="/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1"
但是要注意你得到的警告:
Warning: /home/tex/torch/install/share/lua/5.1/stnbhwd_scm_1-stn/init.lua is not tracked by this installation of LuaRocks
显示您的LUA_PATH,LUA_CPATH设置为
/home/tex/torch/install/share/lua/5.1
首先,尝试在前缀中使用的路径添加到 LUA_PATH,LUA_CPATH
如果这无助于尝试在Lua脚本中指定路径:
-- 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,检查this一个
答案 1 :(得分:0)
我也遇到了同样的问题。我发现这是因为我安装了多版本lua,并且在此期间安装了luarocks。最后,我删除了其他lua版本并重新安装了luarocks,然后使用luarocks重新安装nn,一切顺利。