Closed domcharrier closed 3 years ago
This does not work as expected:
$ hipfc -v hip_implementation.cpp main.f03
HIP_PLATFORM=amd /opt/hlrs/spack/2021-09-30/hip/4.3.1-gcc-7.5.0-jrtbz7k7/bin/hipcc -fno-gpu-rdc -fPIC --offload-arch=gfx906 -c hip_implementation.cpp -o /tmp/hipfc-tmp-96866/hipcc.o
/sw/vulcan-CentOS7/hlrs/non-spack/misc/spack.2021-06-16/spack.develop/var/spack/environments/rocm-4-3-1_gcc-7-5-0/.spack-env/view/bin/hipfc: line 118: HIP_PLATFORM=amd: command not found ERROR: The following command failed with return code 127.
HIP_PLATFORM=amd /opt/hlrs/spack/2021-09-30/hip/4.3.1-gcc-7.5.0-jrtbz7k7/bin/hipcc -fno-gpu-rdc -fPIC --offload-arch=gfx906 -c hip_implementation.cpp -o /tmp/hipfc-tmp-96866/hipcc.o
but when lines 476/477 are as in the previous version the compilation suceeds:
$ hipfc -v hip_implementation.cpp main.f03
/opt/hlrs/spack/2021-09-30/hip/4.3.1-gcc-7.5.0-jrtbz7k7/bin/hipcc -fno-gpu-rdc -fPIC --offload-arch=gfx906 -c hip_implementation.cpp -o /tmp/hipfc-tmp-96971/hipcc.o /opt/spack/2021-09-30/gcc/7.5.0-gcc-7.5.0-24ertx2m/bin/gfortran -cpp -I/opt/hlrs/spack/2021-09-30/hipfort/4.3.1-gcc-7.5.0-xluueefo/include/amdgcn main.f03 /tmp/hipfc-tmp-96971/hipcc.o -L/opt/hlrs/spack/2021-09-30/hipfort/4.3.1-gcc-7.5.0-xluueefo/lib -lhipfort-amdgcn -L/opt/hlrs/spack/2021-09-30/hip/4.3.1-gcc-7.5.0-jrtbz7k7/lib -lamdhip64 -Wl,-rpath=/opt/hlrs/spack/2021-09-30/hip/4.3.1-gcc-7.5.0-jrtbz7k7/lib -lstdc++ -o /zhome/academic/HLRS/hlrs/hpcoft30/a.out
The issue seems to be that the shell function runcmd
tries to execute the local environment variable HIP_PLATFORM=amd
.
When exporting the variable before calling runcmd
it succeeds.
hipfc changes:
<var>=<val> <command>
shell syntax instead.