Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation errors with Intel compiler #123

Open
drtpotter opened this issue Oct 31, 2023 · 11 comments
Open

Compilation errors with Intel compiler #123

drtpotter opened this issue Oct 31, 2023 · 11 comments
Assignees

Comments

@drtpotter
Copy link

drtpotter commented Oct 31, 2023

Hi there,

I'm trying to compile hipfort using the Intel compiler on the hipfort develop branch and getting a few issues. One of them I cannot get around.

These lines, starting at CMakeLists.txt:113, breaks the cmake configuration because the added flags -std=f2003 and -std=f2008 are not valid arguments on the Intel Fortran compiler. Therefore testing of command line arguments in a later step fails and cmake configuration halts with an error.

IF(CMAKE_Fortran_COMPILER_SUPPORTS_F08)
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${HIPFORT_COMPILER_FLAGS} -std=f2008")
ELSE(CMAKE_Fortran_COMPILER_SUPPORTS_F08)
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${HIPFORT_COMPILER_FLAGS} -std=f2003")

If I delete the -std flags in CMakeLists.txt and use the following cmake compile options, then I can get past the cmake configuration step.

# Intel compilation flags
FLAGS="-O2 -g -free -cpp -fPIC -fmax-errors=5 -assume nounderscore"
cmake -DCMAKE_INSTALL_PREFIX=/opt/hipfort_intel/5.7.1 -DHIPFORT_COMPILER=ifort -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_C_COMPILER="icx" -DCMAKE_C_FLAGS="-O2 -g" -DCMAKE_CXX_COMPILER="icpx" -DCMAKE_CXX_FLAGS="-O2 -g" -DCMAKE_Fortran_COMPILER="ifort" -DCMAKE_Fortran_FLAGS="${FLAGS}" -DHIPFORT_COMPILER_FLAGS="${FLAGS}" -DCMAKE_BUILD_TYPE=RELEASE ..

running make then fails at this point.

[  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/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/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
@fluidnumerics-joe
Copy link
Contributor

Hey @drtpotter - Would you be able to give this fork a try : https://github.com/fluidnumerics-joe/hipfort/tree/patch-1

@doctorcolinsmith
Copy link
Contributor

@fluidnumerics-joe Thanks for submitting the patch! We are testing it internally and will update when testing is complete.

@drtpotter
Copy link
Author

drtpotter commented Oct 31, 2023

Hey @fluidnumerics-joe, I gave the patch a try but it needed some additional work to avoid failing at the cmake configure step.
I've made some additional cmake fixes in this fork https://github.com/drtpotter/hipfort/tree/patch-2 and submitted a pull request to your patch-1 branch. With the patch-2 branch we are now past the cmake errors with the latest Intel compilers and don't have to manually specify compiler flags, however the compile error still remains.

cd build
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" ..
make
...
[  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/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/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

It seems strange to me that gfortan would compile this file ok but ifort does not. Any help or suggestions greatly appreciated!

@cgmb
Copy link
Collaborator

cgmb commented Nov 9, 2023

The hipfort project does not officially support the Intel Fortran compiler. However, I'm happy to accept patches from the community to fix any issues found on unsupported platforms, as long as they don't negatively impact the library as built with flang or gfortran.

I will wait on merging Joe's PR since it looks like this is still a work-in-progress.

@domcharrier
Copy link
Contributor

@drtpotter
Thanks for reporting this issue.
@fluidnumerics-joe
Thanks for working on the patch for Intel compilers.

@cgmb
Just a heads up: Be aware that hipfort_hipmalloc.f is generated by the hipfort code generator
from a template file. Joe's patch might thus be overwritten again when
the code generator is turned on again.

@fluidnumerics-joe
Copy link
Contributor

Hey @domcharrier , thanks for the heads up here. Where is the hipfort code generator ? If it's not in the repository, care to share it in a util/ directory of this repository ?

@domcharrier
Copy link
Contributor

@fluidnumerics-joe The code generator is currently a private project.

As the owner, it's up to @cgmb to decide if we make it public.
He could also consider to option to make you an external collaborator to the project,
which is probably the faster option (significantly easier process).

@fluidnumerics-joe
Copy link
Contributor

Either sounds fine.

@cgmb
Copy link
Collaborator

cgmb commented Feb 1, 2024

My preference is to open-source the generator code. However, it requires a fair bit of work first.

@drtpotter
Copy link
Author

My preference is to open-source the generator code. However, it requires a fair bit of work first.

Sounds great Cory, looking forward to it! The ability to use other compilers will most certainly make this library more valuable/useful.

@fluidnumerics-joe
Copy link
Contributor

@cgmb @domcharrier - has the provided patch been integrated into the code generator ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants