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

[Core] Adding support for Intel LLVM compiler (aka ICX, aka DPC++) #12880

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

loumalouomega
Copy link
Member

@loumalouomega loumalouomega commented Nov 27, 2024

📝 Description

This PR involves changes to the kratos_export_api.h file:

  1. Header has been cleaned up.

  2. The header guard (#ifndef KRATOS_EXPORT_API_H) was replaced with a #pragma once directive, which is a modern and more efficient way to prevent multiple inclusions of the header.

  3. Conditional declarations of explicit template instances (KRATOS_API_EXTERN) were updatedto accommodate Intel LLVM (aka ICX, aka DPC++) compilers on Windows.

For now compilation only works with Ninja, settings must be as following:

@echo off
rem Please do not modify this script

rem For any question please contact with us in:
rem  - https://github.com/KratosMultiphysics/Kratos

rem Optional parameters:
rem You can find a list will all the compiation options in INSTALL.md or here:
rem  - https://github.com/KratosMultiphysics/Kratos/wiki/Compilation-options

rem Set variables
if not defined KRATOS_SOURCE set KRATOS_SOURCE=%~dp0..
if not defined KRATOS_BUILD set KRATOS_BUILD=%KRATOS_SOURCE%/build

rem oneAPI call and set compiler
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
set CC=icx.exe
set CXX=icx.exe
@REM Only Ninja compiler is supported with Intel LLVM
set CMAKE_GENERATOR=Ninja


rem Warning: In windows this option only works if you run through a terminal with admin privileges
rem set KRATOS_INSTALL_PYTHON_USING_LINKS=ON

rem Set basic configuration
if not defined KRATOS_BUILD_TYPE set KRATOS_BUILD_TYPE=Release
if not defined BOOST_ROOT set BOOST_ROOT=C:\CompiledLibs\boost_1_67_0
if not defined PYTHON_EXECUTABLE set PYTHON_EXECUTABLE=C:\Windows\py.exe
if not defined NUMBER_OF_COMPILATION_CORES set NUMBER_OF_COMPILATION_CORES=%NUMBER_OF_PROCESSORS%

rem Set applications to compile
set KRATOS_APP_DIR=applications
set KRATOS_APPLICATIONS=
CALL :add_app %KRATOS_APP_DIR%\LinearSolversApplication;
CALL :add_app %KRATOS_APP_DIR%\StructuralMechanicsApplication;
CALL :add_app %KRATOS_APP_DIR%\FluidDynamicsApplication;

rem Clean
del /F /Q "%KRATOS_BUILD%\%KRATOS_BUILD_TYPE%\cmake_install.cmake"
del /F /Q "%KRATOS_BUILD%\%KRATOS_BUILD_TYPE%\CMakeCache.txt"
del /F /Q "%KRATOS_BUILD%\%KRATOS_BUILD_TYPE%\CMakeFiles"

rem Enable this if your build is slow and you have a multi-core machine
rem set KRATOS_PARALLEL_BUILD_FLAG=/MP4

rem Configure
@echo on
cmake                                              ^
-G "%CMAKE_GENERATOR%"                             ^
-H"%KRATOS_SOURCE%"                                ^
-B"%KRATOS_BUILD%\%KRATOS_BUILD_TYPE%"             ^
-DUSE_EIGEN_MKL=OFF                                ^
-DCMAKE_CXX_FLAGS=" %KRATOS_PARALLEL_BUILD_FLAG% " ^
-DKRATOS_GENERATE_PYTHON_STUBS=ON

rem Build
cmake --build "%KRATOS_BUILD%/%KRATOS_BUILD_TYPE%" --target install -- -j%NUMBER_OF_COMPILATION_CORES%
goto:eof

rem Function to add apps
:add_app
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%1;
goto:eof

Thanks @roigcarlo

🆕 Changelog

@loumalouomega
Copy link
Member Author

We may think to add the compìler to the CI?

@loumalouomega
Copy link
Member Author

We may think to add the compìler to the CI?

Maybe replacing the just core compilation?

@loumalouomega loumalouomega marked this pull request as draft November 27, 2024 20:07
@roigcarlo
Copy link
Member

Just as track, currently we have an hard blocker in the linking stage as we are exceeding the number of exposed symbols allowed by the linker.

Should be possible to overcome with -bigobj or /bigobj but the icx-2025 seems to ignore those.

@loumalouomega
Copy link
Member Author

Just as track, currently we have an hard blocker in the linking stage as we are exceeding the number of exposed symbols allowed by the linker.

Should be possible to overcome with -bigobj or /bigobj but the icx-2025 seems to ignore those.

Looks like the abbys is looking us...

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

Successfully merging this pull request may close these issues.

2 participants