#!/bin/bash

module load binutils mpiP qt/5.6.0 cuda/7.5.18 scalasca

gfortran 00_profiling1.f -pg -o 00_profiling1.x
gcc -c mytimer.c
gfortran -pg 00.f mytimer.o -o 00.x -lrt
gfortran -pg 01.f mytimer.o -o 01.x -lrt
mpif90 -pg 02.f -L$MPIPROOT/lib -lmpiP -lbfd -lunwind -o 02.mpip.x
mpif90 -pg 03.f -L$MPIPROOT/lib -lmpiP -lbfd -lunwind -o 03.mpip.x
mpif90 -pg 04.f -L$MPIPROOT/lib -lmpiP -lbfd -lunwind -o 04.mpip.x
mpif90 -pg 05.f -L$MPIPROOT/lib -lmpiP -lbfd -lunwind -o 05.mpip.x

scalasca -instrument mpif90  02.f -o 02.sca.x
scalasca -instrument mpif90  03.f -o 03.sca.x
scalasca -instrument mpif90  04.f -o 04.sca.x
scalasca -instrument mpif90  05.f -o 05.sca.x

