Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build_tools/py/py.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def _add_vpip_compiler_args(ctx, cc_toolchain, copts, conly, args):
action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
)
args.add(c_compiler, format = "--compiler-executable=%s")
args.add(c_compiler, format = "--mpi-executable=%s")
args.add(archiver, format = "--archiver=%s")

# Add base compiler flags from the crosstool. These contain the correct
Expand Down
3 changes: 3 additions & 0 deletions build_tools/py/vpip.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def get_unix_pip_env(venv, venv_source, execroot):
env["F77"] = env["F90"] = os.path.join(os.getcwd(), ARGS.fortran_compiler)
env["AR"] = os.path.join(os.getcwd(), ARGS.archiver)
env["CC"] = os.path.join(os.getcwd(), ARGS.compiler_executable)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be reasonable to do the simpler thing of adding env["MPICC"] = env["CC"] here and not doing any of the other changes?

Copy link
Author

Choose a reason for hiding this comment

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

My only concern is that there might be build scripts that assume that the presence of the environment variable MPICC that it was a valid mpi compiler wrapper and hence try to enable mpi features even if the compiler doesn't work as an MPI compiler.

The reality is though that I am setting it to the same value as CC in _add_vpip_compiler_args and its working for us so I guess its good enough? If we come across any packages this causes an issue we can revisit this with a similar approach to the fortran feature (we're already doing this to select the mpi compiler wrapper for normal cc_* targets).

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, my proposal and this change seem totally equivalent, which is why I asked.

if ARGS.mpi_executable:
env["MPICC"] = os.path.join(os.getcwd(), ARGS.mpi_executable)
env["LD"] = env["CC"]
env["LDSHARED"] = os.path.abspath(
os.path.join(os.path.dirname(__file__), "ldshared-wrapper")
Expand Down Expand Up @@ -547,6 +549,7 @@ def main():
p.add_argument("--toolchain-root", default="/usr")
p.add_argument("--archiver", help="path to unix ar tool")
p.add_argument("--compiler-executable", help="C++ compiler")
p.add_argument("--mpi-executable", help="MPI compiler")
p.add_argument("--fortran-compiler", help="the fortran compiler")
p.add_argument(
"--include-path",
Expand Down