Skip to content

Instantly share code, notes, and snippets.

@markuskowa
Last active January 29, 2019 12:10
Show Gist options
  • Save markuskowa/450cf0bc8d43db7a53e7939b28643009 to your computer and use it in GitHub Desktop.
Save markuskowa/450cf0bc8d43db7a53e7939b28643009 to your computer and use it in GitHub Desktop.
replace_function () {
sed -i "s/$2/$3/" $f # C-code
sed -i "s/${2^^}/${3^^}/" $f # FORTRAN
}
replace_all () {
files=`grep -Rli $1`
for f in $files; do
echo "Replacing $1 in $f"
replace_function $f $1 $2
done
}
echo "Fixing..."
replace_all "MPI_Address" "MPI_Get_address"
replace_all "MPI_Errhandler_set" "MPI_Comm_set_errhandler"
replace_all "MPI_Errhandler_get" "MPI_Comm_get_errhandler"
replace_all "MPI_Errhandler_create" "MPI_Comm_create_errhandler"
replace_all "MPI_Type_hindexed" "MPI_Type_create_hindexed"
replace_all "MPI_Type_hvector" "MPI_Type_create_hvector"
replace_all "MPI_Type_struct" "MPI_Type_create_struct"
replace_all "MPI_COMBINER_HINDEXED_INTEGER" "MPI_COMBINER_HINDEXED"
replace_all "MPI_COMBINER_HVECTOR_INTEGER" "MPI_COMBINER_HVECTOR"
replace_all "MPI_COMBINER_STRUCT_INTEGER" "MPI_COMBINER_STRUCT"
replace_all "MPI_Handler_function" "MPI_Comm_errhandler_function"
replace_all "MPI_Attr_get" "MPI_Comm_get_attr"
echo "Requires manual intervention:"
grep -Ri "MPI_Type_extent"
grep -Ri "MPI_Type_lb"
grep -Ri "MPI_Type_ub"
grep -Ri "MPI_ub"
grep -Ri "MPI_lb"
echo 'See https://www.open-mpi.org/faq/?category=mpi-removed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment