-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add ifx support #404
Add ifx support #404
Conversation
@Leonard-Reuter You'd probably need to add an But as I say in #403 (comment), at least with ifx 2022.2 the compiler is still incomplete. If you are willing to try it out, you can do:
to get the latest GFE. Then you can go into each of the submodules and do the |
However as noted ifx 2022.2 is not yet ready for pFUnit. |
With this patch, ifx 2022.2.0 does build. The only other change I did from pfUnit main branch was copying cmake/Intel.cmake => cmake/IntelLLVM.cmake as above. diff --git a/src/funit/core/NameFilter.F90 b/src/funit/core/NameFilter.F90
index 8483df4..1f3f3da 100644
--- a/src/funit/core/NameFilter.F90
+++ b/src/funit/core/NameFilter.F90
@@ -30,8 +30,12 @@ contains
logical function filter(this, a_test)
class(NameFilter), intent(in) :: this
class(Test), intent(in) :: a_test
+
+ ! workaround for oneAPI ifx 2022.2.0
+ character(:), allocatable :: name
+ name = a_test%getName()
- filter = index(a_test%getName(), this%pattern) > 0
+ filter = index(name, this%pattern) > 0
end function filter
diff --git a/src/funit/fhamcrest/StringContains.F90 b/src/funit/fhamcrest/StringContains.F90
index 127d757..ad23b83 100644
--- a/src/funit/fhamcrest/StringContains.F90
+++ b/src/funit/fhamcrest/StringContains.F90
@@ -35,7 +35,12 @@ contains
class(StringContains), intent(in) :: this
character(*), intent(in) :: item
- eval_substring_of = index(this%converted(item), this%converted(this%get_substring())) > 0
+ ! workaround for Intel oneAPI ifx 2022.2.0
+ character(:), allocatable :: converted, convsub
+ converted = this%converted(item)
+ convsub = this%converted(this%get_substring())
+
+ eval_substring_of = index(converted, convsub) > 0
end function eval_substring_of
end module pf_StringContains
diff --git a/src/funit/fhamcrest/StringEndsWith.F90 b/src/funit/fhamcrest/StringEndsWith.F90
index e8f7a31..ce548d1 100644
--- a/src/funit/fhamcrest/StringEndsWith.F90
+++ b/src/funit/fhamcrest/StringEndsWith.F90
@@ -35,8 +35,13 @@ contains
character(*), intent(in) :: item
integer :: idx_substring
+
+ ! workaround for Intel oneAPI ifx 2022.2.0
+ character(:), allocatable :: buf1, buf2
+ buf1 = this%converted(item)
+ buf2 = this%converted(this%get_substring())
- idx_substring = index(this%converted(item), this%converted(this%get_substring()),back=.true.)
+ idx_substring = index(buf1, buf2, back=.true.)
eval_substring_of = idx_substring == (len(item) - len(this%get_substring()) + 1)
end function eval_substring_of
diff --git a/src/funit/fhamcrest/StringStartsWith.F90 b/src/funit/fhamcrest/StringStartsWith.F90
index 4caf65b..fb90ef5 100644
--- a/src/funit/fhamcrest/StringStartsWith.F90
+++ b/src/funit/fhamcrest/StringStartsWith.F90
@@ -33,7 +33,13 @@ contains
logical function eval_substring_of(this, item)
class(StringStartsWith), intent(in) :: this
character(*), intent(in) :: item
- eval_substring_of = index(this%converted(item), this%converted(this%get_substring())) == 1
+
+ ! workaround for Intel oneAPI ifx 2022.2.0
+ character(:), allocatable :: converted, convsub
+ converted = this%converted(item)
+ convsub = this%converted(this%get_substring())
+
+ eval_substring_of = index(converted, convsub) == 1
end function eval_substring_of
end module pf_StringStartsWith Running
With the same patched code, icx + ifort does pass all |
rebuilding using cmake -Bbuildi -DCMAKE_C_COMPILER=icx -DCMAKE_Fortran_COMPILER=ifx -DSKIP_MPI=yes -DSKIP_OPENMP=yes -DSKIP_FHAMCREST=yes -DSKIP_ROBUST=yes the ctest output is then
|
This patch helps Intel compiler build by not overriding necessary factory options. Especially on windows, where numerous errors occur on any source file before this patch diff --git a/cmake/Intel.cmake b/cmake/Intel.cmake
index 3dbbea8..7405fcb 100644
--- a/cmake/Intel.cmake
+++ b/cmake/Intel.cmake
@@ -1,22 +1,21 @@
# Compiler specific flags for Intel Fortran compiler
+set(check_all -check)
+# check without options == "check all". This helps avoid command line processing issues
+
+set(traceback -traceback)
if(WIN32)
- set(no_optimize "-Od")
- set(check_all "-check:all")
+ set(disable_warning_for_long_names /Qdiag-disable:5462)
else()
- set(no_optimize "-O0")
- set(check_all "-check all")
+ set(disable_warning_for_long_names -diag-disable=5462)
endif()
-
-
-set(disable_warning_for_long_names "-diag-disable 5462")
-set(traceback "-traceback")
-set(cpp "-cpp")
+set(common_flags "${disable_warning_for_long_names}")
-set(common_flags "${cpp} ${disable_warning_for_long_names}")
-set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g ${common_flags} ${traceback} ${no_optimize} ${check_all}")
-set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${common_flags}")
+add_compile_options(
+"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:${traceback};${check_all}>"
+"$<$<COMPILE_LANGUAGE:Fortran>:${common_flags}>"
+)
-add_definitions(-D_INTEL)
-add_definitions(-D__ifort_18)
+add_compile_definitions(_INTEL)
+add_compile_definitions(__ifort_18) |
Just mentioning the related issue: #336 |
Build is now successful with Intel 2023.0 and current pfUnit master, just copying Intel.cmake to IntelLLVM.cmake. However, all tests fail with default configuration. cmake -Bbuildi
-- The Fortran compiler identification is IntelLLVM 2023.0.0
-- The C compiler identification is IntelLLVM 2023.0.0
cmake --build buildi
ctest --test-dir buildi
If I use the following configuration, tests also pass:
1/2 Test #2: new_tests.x ...................... Passed 0.01 sec
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mathomp4 Please check this over. If branch is ok, please fetch it and add our ChangeLog updates and such and we'll roll out a release.
This is a draft pull request, I simply copied Intel.cmake to IntelLLVM.cmake. With
ifx (IFORT) 2021.4.0 Beta 20210924
pFUnit does however not compile due to an compilation error in gFTL-shared: