-
Notifications
You must be signed in to change notification settings - Fork 247
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
base: master
Are you sure you want to change the base?
Conversation
This reverts commit d89f983.
…-dpcpp-windows' of https://github.com/KratosMultiphysics/Kratos into core/support-for-dpcpp-windows
This reverts commit 8d0fd38.
…g _VA_ARGS_ as a token (##)
…ratosMultiphysics/Kratos into Core/support-for-dpcpp-windows
We may think to add the compìler to the CI? |
Maybe replacing the just core compilation? |
This reverts commit c199377.
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 |
Looks like the abbys is looking us... |
Maybe it's finally time to hide symbols by default on compilers other than MSVC too. |
Can you please elaborate? |
If you have a compiled lib and want to use some stuff (functions, classes, etc) from it, that stuff must be exposed by the lib. "Stuff" in a compiled binary are identified by "symbols", and may or may not be exposed (i.e. visible to outside users). Think of functions internal to the library that aren't meant to be invoked by users. The choice of whether or not to export symbols is the developer's decision but is often forgotten about because of default and global compiler settings. GCC and Clang (and by extension I imagine dpcpp too) export everything by default, but MSVC does the opposite: nothing is exported by default and you have to explicitly mark whatever you want accessible in your binary (we use This results in the shitty situations I find myself too often in: I compile kratos locally (using gcc or clang) and everything works perfectly. But then windows fails in the CI with linker errors because I forgot to export my newly added stuff. This is one of the rare occasions when I think that MSVC has the more sensible defaults. I think we should change the export policy on all our compilers not to export symbols by default. We already require everything to run on MSVC so theoretically it's a dead simple change (ideally, no C++ code would have to be changed). Exporting everything bloats our binaries and has some performance impact too as a result. Vomiting everything on our interface is also pretty ugly in my opinion. |
I found this: https://gcc.gnu.org/wiki/Visibility, do you have an idea to do it in a generic way with minimal code change?, I guess that refactoring the KRATOS_API in POSIX cases |
Gemini suggested this: Hiding Symbols in GCC: A Comprehensive Guide Hiding symbols in GCC involves controlling the visibility of symbols, preventing them from being exported and accessible to other modules. This can be achieved using various compiler and linker flags. Understanding Symbol VisibilityBefore diving into the techniques, it's essential to understand the two primary visibility levels:
Techniques to Hide Symbols1. Compiler Flag:
|
My two cents. We tried in the past to had the From code prespective, since the macro exists, and there is already a place for linux, if we want to implement this it should be relatively painless, but I never managed to finish it correctly. |
Probaly Clang was the issue, maybe the flag is different |
Have you tried setting I'd prefer letting CMake do its thing if possible. |
Nope, we didn't tried that. If you manage to make it work we can merge it :) |
📝 Description
This PR involves changes to the
kratos_export_api.h
file:Header has been cleaned up.
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.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:
Thanks @roigcarlo
🆕 Changelog