OpenROAD
OpenROAD copied to clipboard
[bazel] Use `-fopenmp` for Eigen, faster
Originally posted by @maliberty in #7142
OpenMP is used for OpenROAD, but not for all dependencies yet.
- [ ] or-tools, which is pulled in from bcr, does not use
-fopenmp. How can we inject a dependency on openmp headers into or-tools when it is in bcr? Usesingle_version_override()? - [x]
opensta_libis not yet built with-fopenmp, uses Eigen. https://github.com/The-OpenROAD-Project/OpenROAD/pull/7452
$ bazelisk build -c opt :openroad
[deleted]
In file included from src/sta/dcalc/PrimaDelayCalc.cc:25:
In file included from src/sta/dcalc/PrimaDelayCalc.hh:29:
In file included from external/eigen~/Eigen/SparseCore:11:
external/eigen~/Eigen/Core:70:10: fatal error: 'omp.h' file not found
70 | #include <omp.h>
| ^~~~~~~
1 error generated.
Target //test/orfs/mock-array:MockArray_grt failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 282.608s, Critical Path: 65.68s
INFO: 1174 processes: 20 internal, 1154 processwrapper-sandbox.
ERROR: Build did NOT complete successfully
$ git diff
diff --git a/.bazelrc b/.bazelrc
index fe8fcf147d..ab441d970b 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -15,6 +15,8 @@ common --incompatible_disallow_empty_glob
build --cxxopt "-std=c++17" --host_cxxopt "-std=c++17"
build --cxxopt "-xc++" --host_cxxopt "-xc++"
build --cxxopt "-ffp-contract=off" --host_cxxopt "-ffp-contract=off"
+# Use OpenMP for everything, not just OpenROAD.
+build --cxxopt "-fopenmp" --host_cxxopt "-fopenmp"
# allow exceptions.
build --cxxopt=-fexceptions --host_cxxopt=-fexceptions
diff --git a/BUILD.bazel b/BUILD.bazel
index 4a0d2e8361..d02a58479e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -103,7 +103,6 @@ OPENROAD_COPTS = [
"-Wno-unused-parameter",
# FIXME reenable when warnings are fixed
"-Wno-unused-but-set-variable",
- "-fopenmp"
]
OPENROAD_DEFINES = [
@QuantamHD thoughts? I think BCR should address or-tools rather than patching it in OR.