我一直在按照本教程在我的jetson tk1上本地安装openacc,并且我发现安装脚本不正确。我编译openacc库时没有看到任何错误,但是当我尝试编译时,我得到一个错误,上面写着
ubuntu@tegra-ubuntu:~/apps/acc/accull/yacf/examples/acc$ accull -v -o gpu.x acc_test.c
****************************************
_ _ _ _
| | | | | | |
__ _ ___ ___| | | | | | |
/ _` |/ __/ __| | | | | | |
| (_| | (_| (__| |__| | |____| |____
\__,_|\___\___|\____/|______|______|
****************************************
Release 0.4alpha
* Verbose output
* Output executable name gpu.x
* Processing acc_test.c to ./accull_k3Ty8/acc_test.c
* Building acc_test.c
* Running StS translation
Traceback (most recent call last):
File "/home/ubuntu/apps/acc/accull/yacf//bin/c2frangollo.py", line 64, in <module>
from Backends.Frangollo.Mutators.Common import FrangolloMutatorError
File "/home/ubuntu/apps/acc/accull/yacf/Backends/Frangollo/Mutators/Common.py", line 33, in <module>
from Backends.C99.Visitors.LlcFilters import AccScopeReverse, AccScopeFilter
File "/home/ubuntu/apps/acc/accull/yacf/Backends/C99/Visitors/LlcFilters.py", line 40, in <module>
from Tools.Tree import NodeNotFound
File "/home/ubuntu/apps/acc/accull/yacf/Tools/Tree.py", line 34, in <module>
c_ast = getCurrentLanguageAst()
File "/home/ubuntu/apps/acc/accull/yacf/Frontend/Shortcuts.py", line 40, in getCurrentLanguageAst
myclass = __import__(config.FRONTEND_MODULE + '.' + str(name) + "." + str(name).lower() + '_ast', globals(), locals(), [str(name),])
File "/home/ubuntu/apps/acc/accull/yacf/Frontend/C99/__init__.py", line 16, in <module>
from .c99_parser import C99Parser
File "/home/ubuntu/apps/acc/accull/yacf/Frontend/C99/c99_parser.py", line 15, in <module>
import ply.yacc
ImportError: No module named ply.yacc
! Compilation of acc_test.c FAILED (no Project directory build )
/usr/local/cuda/bin/nvcc -Xcompiler -fopenmp -lrt -lcuda -lOpenCL -lrt -lcuda -arch=sm_20 *.o /home/ubuntu/apps/acc/accull/frangollo/src/libfrangollo.a -o gpu.x
nvlink fatal : Could not open input file '*.o'
* Finished
http://scelementary.com/2015/04/30/openacc-on-jetson-tk1.html
#!/bin/bash
ACCULLROOT=/home/ubuntu/apps/acc
mkdir -p $ACCULLROOT/source
cd $ACCULLROOT/source
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
wget https://pypi.python.org/packages/source/S/Sphinx/Sphinx-1.3.1.tar.gz
wget http://lxml.de/files/lxml-3.4.2.tgz
wget http://www.dabeaz.com/ply/ply-3.4.tar.gz
wget https://pypi.python.org/packages/source/M/Mako/Mako-1.0.1.tar.gz
tar xvf Python-2.7.9.tar.xz
cd Python-2.7.9/
./configure --prefix=$ACCULLROOT
make -j2
make install
list=(Sphinx-1.3.1.tar.gz lxml-3.4.2.tgz ply-3.4.tar.gz Mako-1.0.1.tar.gz)
for file in $list
do
if [ "$file" == "*.tgz" ]
name=$(basename $file .tgz)
then
name=$(basename $file .tar.gz)
fi
tar zxvf $file
cd $basename
$ACCULLROOT/bin/python setup.py build
$ACCULLROOT/bin/python setup.py install
cd ..
done
答案 0 :(得分:1)
有几个问题:
list
的数组,但是您尝试迭代其for file in $list
这样的元素,这些元素只会迭代第一个元素,因为$list
就像${list[0]}
。
使用for file in "${list[@]}"
迭代整个数组。name=$(basename $file .tar.gz)
的值包含空格并且没有双引号(即tar zxvf $file
而不是file
,则$file
或"$file"
会产生不需要的结果正确的形式:cd $basename
)cd "$name"
而不是name
- 或其他什么,如果它没有意义。无论如何变量[ "$file" == "*.tgz" ]
似乎未被使用。"$file"
可能不对。似乎作者试图将[[
与 glob 模式进行匹配。好吧,为了做到这一点,必须改变两件事:1。使用[
而不是[
,因为命令"$file"
根本不支持 glob 匹配。 2.应删除* .tgz附近的双引号 - 否则,*.tgz
将与文字[[ $file = *.tgz ]]
匹配。因此,为了总结1和2,脚本应该使用[ "$file" == "*.tgz" ]
而不是cd
。我鼓励您进一步阅读有关TestsAndConditionals的信息,并看看这个FAQ这个Bash Guide的一部分,这可能是学习Bash的最佳(如果不是唯一的)来源之一从cd || exit
是否已成功退出,只是继续。它会产生不必要的结果。首选ACCULLROOT
,但将其修改为对用户具有描述性。PATH
:按照惯例,环境变量(EDITOR
,SHELL
,BASH_VERSION
,...)和内部shell变量(RANDOM
,node runfile.js accountName
,...)完全大写。所有其他变量名称应为小写。以来
变量名称区分大小写,这种约定避免意外地覆盖环境和内部变量。