ROCm / hipfort

Fortran interfaces for ROCm libraries
https://rocm.docs.amd.com/projects/hipfort/en/latest/
Other
66 stars 34 forks source link

Update CMakeLists.txt #124

Open fluidnumerics-joe opened 8 months ago

fluidnumerics-joe commented 8 months ago

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 commented 8 months ago

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

cgmb commented 8 months ago

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

fluidnumerics-joe commented 8 months ago

@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 ?

drtpotter commented 8 months ago

@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!

fluidnumerics-joe commented 8 months ago

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

fluidnumerics-joe commented 7 months ago

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.

cgmb commented 7 months ago

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.

fluidnumerics-joe commented 7 months ago

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..