From bcbbc32fa63b39552f2adeb932cb554870c95cab Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Fri, 23 Dec 2016 22:06:20 +0300 Subject: [PATCH] [HIPIFY] Add hipconvertinplace2.sh and hipexamine2.sh scripts for hipify-clang. The differences from the similar scripts for hipify.pl: 1. CSV file with extended statistics is produced. 2. scripts' arguments are changed a bit: DIRNAME [hipify options] [--] [clang options] where -- is a delimiter; all the arguments are optional, except DIRNAME. Usage example: ./hipexamine2.sh ./tmp -o-stats ./tmp/stats.csv -- -I/usr/local/cuda-7.5/include -I/usr/local/hipify-clang/hipblas/include 2>&1 | tee log --- bin/hipconvertinplace2.sh | 24 ++++++++++++++++++++++++ bin/hipexamine2.sh | 22 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 bin/hipconvertinplace2.sh create mode 100644 bin/hipexamine2.sh diff --git a/bin/hipconvertinplace2.sh b/bin/hipconvertinplace2.sh new file mode 100644 index 0000000000..a765ab39fa --- /dev/null +++ b/bin/hipconvertinplace2.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +#usage : hipconvertinplace.sh DIRNAME [hipify options] [--] [clang options] + +#hipify "inplace" all code files in specified directory. +# This can be quite handy when dealing with an existing CUDA code base since the script +# preserves the existing directory structure. + +SCRIPT_DIR=`dirname $0` +SEARCH_DIR=$1 + +hipify_args='' +while (( "$#" )); do + shift + if [ "$1" != "--" ]; then + hipify_args="$hipify_args $1" + else + shift + break + fi +done +clang_args="$@" + +$SCRIPT_DIR/hipify-clang -inplace -print-stats $hipify_args `$SCRIPT_DIR/findcode.sh $SEARCH_DIR` -- -x cuda $clang_args diff --git a/bin/hipexamine2.sh b/bin/hipexamine2.sh new file mode 100644 index 0000000000..2a6fab7110 --- /dev/null +++ b/bin/hipexamine2.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +#usage : hipexamine2.sh DIRNAME [hipify options] [--] [clang options] + +# Generate CUDA->HIP conversion statistics for all the code files in the specified directory. + +SCRIPT_DIR=`dirname $0` +SEARCH_DIR=$1 + +hipify_args='' +while (( "$#" )); do + shift + if [ "$1" != "--" ]; then + hipify_args="$hipify_args $1" + else + shift + break + fi +done +clang_args="$@" + +$SCRIPT_DIR/hipify-clang -examine $hipify_args `$SCRIPT_DIR/findcode.sh $SEARCH_DIR` -- -x cuda $clang_args