Skip to content

Conversation

dbabokin
Copy link
Contributor

Closes #959

See the issue for detailed problem description.

@adam-smnk
Copy link
Contributor

Looks like gcc has trouble with these changes.

@adam-smnk adam-smnk added the benchmark Benchmark base targets label Aug 30, 2024
@dbabokin
Copy link
Contributor Author

I can reproduce it. The problem is that with gcc it pulls in gcc's libgomp.so.1 instead of llvm's libomp.so.5. 🤔

@dbabokin
Copy link
Contributor Author

dbabokin commented Aug 30, 2024

I see no way to specify for find_package(OpenMP) that it needs llvm version. Not sure how to fix that properly.

@rengolin
Copy link
Contributor

rengolin commented Sep 4, 2024

The way we were doing it was not portable "for a reason": we don't want to use Gomp because the performance isn't good.

I'm not saying it was done in the right way, clearly not. But the reason is still important.

So, my tip for this PR is to find a way to make it portable, but still require LLVM's OpenMP library and not the compiler's own.

CMake find_package can be fiddled with HINTs and other flags, maybe this helps?

@dbabokin
Copy link
Contributor Author

dbabokin commented Sep 4, 2024

The way we were doing it was not portable "for a reason": we don't want to use Gomp because the performance isn't good.

Yeah, totally understand. Showing up of gomp when gcc was used was absolutely unexpected. The definition of "portable" that seems acceptable in this case is that it works on macOS and Ubuntu 24.04 - all with llvm's omp.

I'm not saying it was done in the right way, clearly not. But the reason is still important.

So, my tip for this PR is to find a way to make it portable, but still require LLVM's OpenMP library and not the compiler's own.

CMake find_package can be fiddled with HINTs and other flags, maybe this helps?

HINT is a Windows thing, PATH probably may help, I'll give it a try. I'll also file an issue for CMake to get it fixed in the long run.

@dbabokin
Copy link
Contributor Author

dbabokin commented Sep 4, 2024

I file CMake issue for that: https://gitlab.kitware.com/cmake/cmake/-/issues/26263

@rengolin
Copy link
Contributor

I'm closing this in favour of #984 which should work around the fact that we want LLVM's version.

The answer in the CMake issue you reported means to me they won't try to make this better in any way.

@rengolin rengolin closed this Nov 21, 2024
rengolin added a commit that referenced this pull request Dec 24, 2024
This should replace #960.

It worked on my Ubuntu for both Clang and GCC.

@dbabokin please check that this works for you, too.

Fixes #959.
@rengolin
Copy link
Contributor

rengolin commented Mar 3, 2025

Just updated to Ubuntu 24.04 and got the same problem reported here, and the PR here does fix the issue. I'll reopen this and will test on other environments. Since we don't run benchmarks with GCC, I think it will be fine.

@rengolin rengolin reopened this Mar 3, 2025
@rengolin
Copy link
Contributor

rengolin commented Mar 3, 2025

The problem with GCC tests is:

JIT session error: Symbols not found: [ __kmpc_barrier, __kmpc_for_static_fini, __kmpc_for_static_init_8u, __kmpc_fork_call, __kmpc_global_thread_num ]
Error: Failed to materialize symbols: { (main, { entry, _mlir__entry..omp_par, _mlir_entry, _mlir__entry, _entry }) }

@rengolin
Copy link
Contributor

rengolin commented Mar 4, 2025

#1019 superseeds it.

@rengolin rengolin closed this Mar 4, 2025
rengolin added a commit that referenced this pull request Mar 4, 2025
This is now more robust than my previous trick, using @dbabokin's code
and only hacking `openmp.cmake`, not the other ones. This works on my
machine for GCC and Clang, let's see what the CI thinks about it.

Fixes #959

---------

Co-authored-by: Dmitry Babokin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Benchmark base targets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build issues on Ubuntu 24.04 - incorrect openmp linkage in CMake
3 participants