Skip to content

[Cleanup] Use LLVM 19 from Debian and support cross-compilation for arm64#9

Open
DaMatrix wants to merge 5 commits intospcl:mainfrom
DaMatrix:cleanup/llvm-cross-compile
Open

[Cleanup] Use LLVM 19 from Debian and support cross-compilation for arm64#9
DaMatrix wants to merge 5 commits intospcl:mainfrom
DaMatrix:cleanup/llvm-cross-compile

Conversation

@DaMatrix
Copy link
Copy Markdown
Contributor

This makes the following changes:

  • Docker images now use LLVM 19 from Debian Trixie instead of compiling it themselves
  • Added a new builder-19-cross Docker image which contains necessary headers and libraries to compile code for both x86_64 and aarch64 (including with OpenMP, but currently missing support for cuda and mpich)
    • This is a stopgap solution, eventually this will probably be replaced with separate builder images for each architecture and build tool
  • Made the cpu_architecture field in the run config YAML actually affect the target architecture for source files compiled with clang

Known regessions:

  • Anything using nvcc or mpich currently won't build, I've omitted them from the builder image for now. Maybe this should be PRd to a separate staging branch until I can fully implement that?

This eliminates the need for all the '-dev' images. Some tools still need to have their Dockerfile updated from Ubuntu 22.04.
It's all pretty useless now that the -dev images themselves no longer exist
…ned in config

This makes it possible to cross-compile for different target architectures, as long as the builder image contains the necessary toolchains.
Nobody (not even LLVM themselves) ships libomp-dev in a way which is compatible with multiarch toolchains, so you normally can't cross-compile with clang using -fopenmp. Debian DOES have cross-compilation libraries for libgomp, and these actually work just fine when cross-compiling with GCC, but clang refuses to build against anything other than libomp, so that isn't an option.

To work around this, we can simply download the libomp packages for all architectures and manually extract libomp.so.5 into /usr/<target>/lib/, which seems to be enough to satisfy clang and allow it to link with -fopenmp. None of this matters at runtime, since we can just install libomp normally and it'll link dynamically just fine.

Also, changed some code to build using cross-compilation builder image by default. Maybe we'll enable cross-compilation in the default builder image eventually?
FROM spcleth/xaas:llvm-19
ARG CUDA_VERSION

#TODO: disabled: COPY --link --from=mpich /opt/mpich /opt/mpich
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the plan that builder image will not have it by default, but we will enable it dynamically when features are known?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that was my plan eventually. It seems kinda arbitrary for the base builder image to contain some dependencies by default but not all of them, it just adds bloat and makes things inconsistent.

Comment thread dockerfiles/Dockerfile.builder-19
Copy link
Copy Markdown
Contributor

@mcopik mcopik left a comment

Choose a reason for hiding this comment

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

So far so good :-)

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.

2 participants