hipfort icon indicating copy to clipboard operation
hipfort copied to clipboard

Update CMakeLists.txt

Open fluidnumerics-joe opened this issue 2 years ago • 8 comments
trafficstars

Add conditional for intel compilers; don't use the -std= flag for enforcing fortran standard interpretation

This PR is meant to address #123

fluidnumerics-joe avatar Oct 31 '23 12:10 fluidnumerics-joe

@cgmb - Do you test builds against the intel compiler ?

fluidnumerics-joe avatar Oct 31 '23 20:10 fluidnumerics-joe

Unfortunately, no. At the moment, we only test against flang.

cgmb avatar Nov 03 '23 05:11 cgmb

@drtpotter - I got the cray compiler building fine now with the latest commit. I gather this is also working with the Intel compilers ? @cgmb - Can you see if these commits still function for other tests you may run internally at AMD ?

fluidnumerics-joe avatar Nov 15 '23 17:11 fluidnumerics-joe

@drtpotter - I got the cray compiler building fine now with the latest commit. I gather this is also working with the Intel compilers ? @cgmb - Can you see if these commits still function for other tests you may run internally at AMD ?

Hi @fluidnumerics-joe. Yes! With the patch-1 branch the CMAKE configuration step continues to be successful with the latest Intel compilers.

cmake -DCMAKE_INSTALL_PREFIX=/opt/hipfort_intel/5.7.1 -DHIPFORT_COMPILER=ifort -DCMAKE_C_COMPILER="icx" -DCMAKE_CXX_COMPILER="icpx" -DCMAKE_Fortran_COMPILER="ifort" ..cmake -DCMAKE_INSTALL_PREFIX=/opt/hipfort_intel/5.7.1 -DHIPFORT_COMPILER=ifort -DCMAKE_C_COMPILER="icx" -DCMAKE_CXX_COMPILER="icpx" -DCMAKE_Fortran_COMPILER="ifort" ..

However, at the compile stage it still fails when trying to compile hipfort_hipmalloc.f.

[  6%] Building Fortran object lib/CMakeFiles/hipfort-amdgcn.dir/hipfort/hipfort_hipmalloc.f.o
ifort: command line warning #10006: ignoring unknown option '-fno-underscoring'
ifort: command line remark #10148: option '-vec-report0' not supported
/netsoft/src/hipfort_joe/lib/hipfort/hipfort_hipmalloc.f(1007): error #6911: The syntax of this substring is invalid.   [PTR]
        ptr(LBOUND(dsource,1):,LBOUND(dsource,2):) => tmp
--------^
compilation aborted for /netsoft/src/hipfort_joe/lib/hipfort/hipfort_hipmalloc.f (code 1)
make[2]: *** [lib/CMakeFiles/hipfort-amdgcn.dir/build.make:231: lib/CMakeFiles/hipfort-amdgcn.dir/hipfort/hipfort_hipmalloc.f.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:144: lib/CMakeFiles/hipfort-amdgcn.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

The Intel Fortran compiler produces really high quality and performant code, and can often find optimization opportunities that open source compilers sometimes miss. It would be really great to have support for the Intel compiler in hipfort!

drtpotter avatar Nov 15 '23 22:11 drtpotter

Hmm.. I'll see if I can put together a build environment for ifort+ROCm to reproduce what you have here.

fluidnumerics-joe avatar Nov 16 '23 01:11 fluidnumerics-joe

Quick update on this. I'm able to reproduce the problem that @drtpotter has mentioned with ifort. To be honest, I'm not sure why GNU compilers don't choke on this. The problem appears to be that ptr is an assumed shape pointer with no defined upper and lower bounds. However, at the line in questions (and many others) the lower bounds of either mold or source are used to index the lower bounds of ptr.

With ifort, these errors can be fixed by simply using ptr => tmp; I'll try out some of the included examples on our systems (MI210 and MI50) with this build.

@cgmb , would you be open to at least adding a Github action to verify hipfort can be built with the Intel compilers ? If so, I can provide a workflow as part of the pull request.

fluidnumerics-joe avatar Dec 08 '23 22:12 fluidnumerics-joe

Thanks for looking into this, Joe.

@cgmb, would you be open to at least adding a Github action to verify hipfort can be built with the Intel compilers ? If so, I can provide a workflow as part of the pull request.

Sure. I'd be happy to accept GitHub actions that test for any compiler you care about. It would be great to have a CI system that is accessible to external contributors.

cgmb avatar Dec 12 '23 21:12 cgmb

Excellent, I'll add in tests that demonstrate hipfort can build with gfortran, ifort, and ifx (for the moment). It'd be great to figure out if we can prove the examples run for these builds..

fluidnumerics-joe avatar Dec 14 '23 16:12 fluidnumerics-joe