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

Support for Cray 8.7 compilation #200

Merged
merged 1 commit into from
Apr 9, 2019

Conversation

wdeconinck
Copy link
Contributor

This PR adds support for Cray 8.7 compilers.

It is known to fail with Cray 8.6 so I have added the appropriate warning in SerialboxCheckCxxCompilerSupport.cmake . Mostly failures are due to the external json.hppfile. However quite positive that it now works with 8.7

Note that I had to make a minor fix to the external file json.hpp, which you may want to propagate upstream.

It also seems to work fine in generating shared libraries (mainly due to fixes in recent CMake 3.12 versions and above). CMake 3.12 seems to be a requirement for Serialbox in nested directories although the top level only mentions CMake 3.9 required.

@@ -81,7 +81,9 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Shared architecture flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
if( NOT ( CMAKE_CXX_COMPILER_ID MATCHES "Cray" ) )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag is not supported with the Cray compiler

@@ -9,7 +9,7 @@

# General Flags (add to default)
set(CMAKE_Fortran_FLAGS
"${CMAKE_Fortran_FLAGS} -ffree -eZ -N255 -ec -eC -eI -eF -hnosecond_underscore -hflex_mp=conservative -Ofp1 -hadd_paren -ra")
"${CMAKE_Fortran_FLAGS} -ffree -N255 -ec -eC -eI -eF -hnosecond_underscore -hflex_mp=conservative -Ofp1 -hadd_paren -ra")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing "-eZ" which forces preprocessing, but there's nothing to preprocess in any of the files. By default if you want preprocessing, change the file extension from .f90 to .F90 and the compiler will do the right thing.
The compiler seemed to fall over until this flag was removed.

@jenkins-apn
Copy link
Collaborator

Hi there, this is jenkins continuous integration...
Do you want me to verify this patch?

@@ -14431,7 +14431,7 @@ class basic_json
{
basic_json&& key = init.begin()->moved_or_copied();
push_back(typename object_t::value_type(
std::move(key.get_ref<string_t&>()), (init.begin() + 1)->moved_or_copied()));
std::move(key.template get_ref<string_t&>()), (init.begin() + 1)->moved_or_copied()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the Cray compiler gave the error

 The indicated type name is not allowed.
                       std::move(key.get_ref<string_t&>()), (init.begin() + 1)->moved_or_copied()));
                                             ^

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take this change, but I will not guarantee that it won't break again in the future, as Cray for C++ compilation is not a target for us. I'll probably add it to our CI once #207 is resolved in some way, but in case it fails with a different error on an updated json.hpp I won't spend a lot of time in trying to fix it.

@@ -66,7 +66,7 @@
///
/// On compilers which support it, expands to an expression which states that it is undefined
/// behaviour for the compiler to reach this point. Otherwise is not defined.
#if __has_builtin(__builtin_unreachable) || SERIALBOX_GNUC_PREREQ(4, 5, 0)
#if (__has_builtin(__builtin_unreachable) || SERIALBOX_GNUC_PREREQ(4, 5, 0) ) && ! defined(_CRAYC)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Cray compiler seems to enter this branch, but does not provide a symbol for __builtin_unreachable() so that we get an undefined reference at link time.
This chunk bypasses this branch for the Cray compiler

set_target_properties(${ARG_NAME} PROPERTIES COMPILE_FLAGS -Wall)
elseif( CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
set_target_properties(${ARG_NAME} PROPERTIES COMPILE_FLAGS -warn all )
endif()
endif()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cray compiler does not accept "-Wall" flag

@havogt
Copy link
Collaborator

havogt commented Mar 5, 2019

Thanks, Willem. I'll have a look at the PR on Thursday.

@havogt
Copy link
Collaborator

havogt commented Mar 5, 2019

launch jenkins

@havogt havogt merged commit 01bdcfc into GridTools:master Apr 9, 2019
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

Successfully merging this pull request may close these issues.

3 participants