Files
opm-simulators/bin/hipify_file.sh
T
Arne Morten Kvarving b8df2af8bc fixed: properly probe for hipify-perl command
error out in configuration instead of surprising user during build
2025-11-04 11:08:19 +01:00

23 lines
821 B
Bash

#!/bin/bash
set -e # Make sure the script fails if a command fails
# the script is intended to be run like this: bash hipify_file.sh ${PROJECT_BUILD_DIR} ${PROJECT_BINARY_DIR}
# it should be run automatically on the correct files through cmake
input_file=$1
output_file=$2
hipify_command=$3
# make sure the output folder exists
mkdir -p $(dirname $output_file)
# hipify out-of-place
$hipify_command $input_file > $output_file
# expand includes so we only need include_directories (path to hip)
sed -i 's/^#include <hipblas\.h>/#include <hipblas\/hipblas.h>/g' $output_file
sed -i 's/^#include <hipsparse\.h>/#include <hipsparse\/hipsparse.h>/g' $output_file
# make sure includes refer to hipistl/ files (the ones that are also hipified)
sed -i 's/gpuistl\//gpuistl_hip\//g' $output_file
echo "$output_file hipified"