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

Add Intel ICC 18 detection/support to CMakeLists.txt #1841

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Spudz76
Copy link
Contributor

@Spudz76 Spudz76 commented Sep 19, 2018

  • Detect ICC-18, add their header and lib paths

  • Select newest available and compatible GCC and pass to ICC to avoid built-in default of using /usr/bin/gcc which in some distro revisions is too old

  • Use -DICC_GCCVER=N to force specific gcc-N

  • Link to Intel lib

@Spudz76
Copy link
Contributor Author

Spudz76 commented Sep 19, 2018

Fresh on the heels of ICC-19 release, here is ICC-18 support...
I have not yet tried ICC-19

Spudz76 added a commit to Spudz76/xmr-stak that referenced this pull request Sep 19, 2018
@psychocrypt psychocrypt self-requested a review September 24, 2018 06:31
@psychocrypt psychocrypt self-assigned this Sep 24, 2018
Copy link
Collaborator

@psychocrypt psychocrypt left a comment

Choose a reason for hiding this comment

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

I need to test it by my self. Some changes looks like workarounds for a not correct configured icc.

@@ -28,6 +28,25 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
message(FATAL_ERROR "g++ version must be at least 5.1!")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
include_directories(BEFORE "/opt/intel/include")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do not hard code any path's. It could be that the compiler is installed somewhere else even if this path is the default path.

get_filename_component(ICC_GXX ${ICC_GXX} NAME)
find_program(ICC_GCC NAMES "gcc-${ICC_GCCVER}" "gcc-7" "gcc-6" "gcc")
get_filename_component(ICC_GCC ${ICC_GCC} NAME)
set(ICC_COMPILERS "-gxx-name=${ICC_GXX} -gcc-name=${ICC_GCC}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this is the correct way, because if I install icc I select already an gcc version. This looks like a workaround.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What, where? I run the installer, remove everything but the C++, it never asks it only seeks whatever /usr/bin/gcc points to... system default

I also use this to generate test binaries made with every permutation of ICC+GCC regardless what was configured or what the system defaults are. So yes, it is a workaround, for having to use the ICC environment at all (I don't use their shell scripts or whatever). I also don't have ICC in the system path.

@Spudz76
Copy link
Contributor Author

Spudz76 commented Sep 24, 2018

Example of what happens otherwise:

[ 31%] Building CXX object CMakeFiles/xmr-stak-backend.dir/xmrstak/backend/backendConnector.cpp.o
In file included from /usr/src/xmr-stak/./xmrstak/backend/pool_data.hpp(3),
                 from /usr/src/xmr-stak/./xmrstak/backend/miner_work.hpp(3),
                 from /usr/src/xmr-stak/./xmrstak/backend/globalStates.hpp(3),
                 from /usr/src/xmr-stak/xmrstak/backend/iBackend.hpp(3),
                 from /usr/src/xmr-stak/xmrstak/backend/backendConnector.cpp(24):
/usr/include/c++/8/cstdint(38): catastrophic error: cannot open source file "bits/c++config.h"
  #include <bits/c++config.h>
                             ^

compilation aborted for /usr/src/xmr-stak/xmrstak/backend/backendConnector.cpp (code 4)

It has picked up gcc-8 and crashes out. You probably have never had gcc-8 on the same system as icc-18? This compiler test box has gcc 5,6,7,8 and clang 3.8,3.9,4.0,5.0,6.0,7,8 and icc-18.

icc by itself is too stupid to avoid gcc-8 even though it does not work.

@Spudz76
Copy link
Contributor Author

Spudz76 commented Sep 24, 2018

Confirmed, I set my system compiler back to gcc-7 and icc works without these mods.
However if /usr/bin/gcc is actually gcc-8 then icc crashes.

I will rework this patch so it is more generic.

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

Successfully merging this pull request may close these issues.

2 participants