8000 Add openmp to the XFEL builder by default by phyy-nx · Pull Request #1063 · cctbx/cctbx_project · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add openmp to the XFEL builder by default #1063

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

Merged
merged 1 commit into from
Apr 18, 2025
Merged

Add openmp to the XFEL builder by default #1063

merged 1 commit into from
Apr 18, 2025

Conversation

phyy-nx
Copy link
Contributor
@phyy-nx phyy-nx commented Apr 16, 2025

This is the end of a rabbit hole of dependencies. I thought I'd write it here in case it comes up again. Thanks @fredericpoitevin and @nksauter.

  • psana is being upgraded to psana2, which can read xtc2, the file format created by lcls2
  • We found that the order of imports would cause a failure in a minimal script which connected to a psana2 data source. This would fail:
import rstbx.cftbx
import psana

But this would pass

import psana
import rstbx.cftbx
  • The problem was that cftbx triggers an import of rstbx/__init__.py which includes omptbx_ext, the OpenMP adapter in cctbx. At this point we think we know what happens next.
  • omptbx/omp_or_stubs.h includes this code:
#if defined(_OPENMP)
# define OMPTBX_HAVE_OMP_H
# include <omp.h>
#else
# define OMPTBX_HAVE_STUBS_H
# include <omptbx/stubs.h>
#endif

In other words, if OpenMP is enabled, use omp.h, otherwise stub out the OpenMP API. Since the new psana2 included a library which uses OpenMP (we think), these stubs would clobber psana.

Since we can't easily swap import orders around in the larger codebase, instead making --enable_openmp_if_possible=True the default for the XFEL builder is the best work around. That's already the case for the Phaser and Phenix builders so its not such a big step.

@JBlaschke
Copy link
Contributor

I approve! See Gchat

@phyy-nx phyy-nx merged commit 2c38db9 into master Apr 18, 2025
101 checks passed
@phyy-nx phyy-nx deleted the xfel_openmp branch April 18, 2025 16:59
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
0