[9017] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | export LD_LIBRARY_PATH=/usr/local/cuda/lib64/:/usr/local/cuda/lib:/home/u5044856/.local/lib/python2.7/site-packages/:$LD_LIBARAY_PATH |
---|
| 4 | |
---|
| 5 | export PYTHONPATH=/usr/lib/python2.7/dist-packages/:/usr/bin/python:/home/u5044856/anuga_core/source:/usr/include/python2.7/numpy:/home/u5044856/anuga-cuda:/home/u5044856/.local/lib/python2.7/site-packages/:$PYTHONPATH |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | export CUDA_PROFILE_CONFIG=".cp_config" |
---|
| 10 | export CUDA_PROFILE_CSV=1 |
---|
| 11 | compute_profile=cvp_output_0 |
---|
| 12 | export CUDA_PROFILE_LOG="$compute_profile.csv" |
---|
| 13 | export CUDA_PROFILE=1 |
---|
| 14 | export CUDA_INSTALL_PATH=/usr/local/cuda/ |
---|
| 15 | |
---|
| 16 | export PATH=/usr/local/cuda/bin:/usr/bin/python:$PATH |
---|
| 17 | |
---|
| 18 | function_only=false |
---|
| 19 | |
---|
| 20 | if [ "$#" == 0 ]; then |
---|
| 21 | echo "Usage: runPycuda <script_name>" |
---|
| 22 | else |
---|
| 23 | if [ "$1" == "-fo" ]; then |
---|
| 24 | shift |
---|
| 25 | function_only=true |
---|
| 26 | fi |
---|
| 27 | |
---|
| 28 | file_name=${1##*/} |
---|
| 29 | file_dir=${1%/*} |
---|
| 30 | if [ $file_name == $file_dir ]; then |
---|
| 31 | file_dir=. |
---|
| 32 | fi |
---|
| 33 | shift |
---|
| 34 | |
---|
| 35 | echo -e "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*" |
---|
| 36 | echo -e "*-*- Executing $file_name with profile " |
---|
| 37 | echo -e "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*\n" |
---|
| 38 | CUDA_PROFILE=1 python $file_dir/$file_name $@ |
---|
| 39 | |
---|
| 40 | if [ $? == 0 ]; then |
---|
| 41 | |
---|
| 42 | echo -e "\n*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*" |
---|
| 43 | echo -e "*-*- Showing profile result in $pro_name " |
---|
| 44 | echo -e "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n" |
---|
| 45 | cvp_output < $compute_profile.csv > $compute_profile.log |
---|
| 46 | cvp_summarize < $compute_profile.csv > $compute_profile.summ |
---|
| 47 | #echo "CVP full output is in $CUDA_PROFILE_LOG.log, summary in $CUDA_PROFILE_LOG.summ" |
---|
| 48 | |
---|
| 49 | if [ $function_only ]; then |
---|
| 50 | cat $compute_profile.summ #| grep -v thread |
---|
| 51 | else |
---|
| 52 | cat $compute_profile.summ |
---|
| 53 | fi |
---|
| 54 | fi |
---|
| 55 | fi |
---|
| 56 | |
---|