source: trunk/anuga_work/anuga_cuda/src/scripts/runPycuda @ 9334

Last change on this file since 9334 was 9017, checked in by steve, 11 years ago

Adding in Zhe (John) Weng's anuga_cuda code as obtained from googlecode https://code.google.com/p/anuga-cuda

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/bash
2
3export LD_LIBRARY_PATH=/usr/local/cuda/lib64/:/usr/local/cuda/lib:/home/u5044856/.local/lib/python2.7/site-packages/:$LD_LIBARAY_PATH
4
5export 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
9export CUDA_PROFILE_CONFIG=".cp_config"
10export CUDA_PROFILE_CSV=1
11compute_profile=cvp_output_0
12export CUDA_PROFILE_LOG="$compute_profile.csv"
13export CUDA_PROFILE=1
14export CUDA_INSTALL_PATH=/usr/local/cuda/
15
16export PATH=/usr/local/cuda/bin:/usr/bin/python:$PATH
17
18function_only=false
19
20if [ "$#" == 0 ]; then
21    echo "Usage: runPycuda <script_name>"
22else
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
55fi
56
Note: See TracBrowser for help on using the repository browser.