Skip to content

Commit 39c20b7

Browse files
Joe-DownsJoseph Downs
authored andcommitted
WIP: use pympistandard by editing PYTHONPATH (instead of using venv)
1 parent d1aece4 commit 39c20b7

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

ompi/mpi/bindings/c_header.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import argparse
1111
import re
1212
import json
13+
import sys
14+
import os
1315
from pathlib import Path
1416

15-
import pympistandard as std
16-
1717
# ============================= Constants / Globals ============================
1818
DIR = Path(".")
1919
OUTPUT = DIR / "mpi.h"
@@ -80,6 +80,7 @@
8080
parser.add_argument("-o", "--output", type=str, help="output path for the header file")
8181
parser.add_argument("--mangle-names", help="enable name mangling for constants and datatypes", action="store_true")
8282
parser.add_argument("--no-mangle", help="disable name mangling (default)", action="store_true")
83+
parser.add_argument("--pympistd-dir", type=str, help="directory for the pympistandard library")
8384

8485
args = parser.parse_args()
8586

@@ -93,6 +94,15 @@
9394
OUTPUT = Path(args.output)
9495
if args.input:
9596
INPUT = Path(args.input)
97+
if args.pympistd_dir:
98+
PYMPISTANDARD_DIR = Path(args.pympistd_dir)
99+
100+
# A bit of a hack to load the pympistandard module, which is in
101+
# the Open MPI '3rd-party" tree in the source dir.
102+
pympi_dir = PYMPISTANDARD_DIR / "src"
103+
sys.path.insert(0, str(pympi_dir.resolve()))
104+
105+
import pympistandard as std
96106

97107
# ================================== Load JSON =================================
98108
with open(JSON_PATH) as f:

ompi/mpi/c/Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ standard_abi/mpi.h: $(top_srcdir)/docs/mpi-standard-apis.json $(top_srcdir)/ompi
565565
$(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/c_header.py \
566566
--input $(top_srcdir)/ompi/mpi/c/abi.h.in \
567567
--abi-json $(top_srcdir)/docs/mpi-standard-abi.json \
568+
--pympistd $(top_srcdir)/3rd-party/pympistandard/src \
568569
--output $(top_srcdir)/ompi/mpi/c/standard_abi/mpi.h
569570

570571
# Mangled version
@@ -573,6 +574,7 @@ abi.h: $(top_srcdir)/docs/mpi-standard-apis.json $(top_srcdir)/ompi/mpi/bindings
573574
--input $(top_srcdir)/ompi/mpi/c/abi.h.in \
574575
--output $(top_srcdir)/ompi/mpi/c/abi.h \
575576
--abi-json $(top_srcdir)/docs/mpi-standard-abi.json \
577+
--pympistd-dir $(top_srcdir)/3rd-party/pympistandard \
576578
--mangle-names
577579

578580
%_abi_generated.c: %.c.in
@@ -586,7 +588,7 @@ abi.h: $(top_srcdir)/docs/mpi-standard-apis.json $(top_srcdir)/ompi/mpi/bindings
586588
$<
587589
endif
588590

589-
MAINTAINERCLEANFILES = *_generated.c abi.h
591+
MAINTAINERCLEANFILES = *_generated.c $(nobase_include_HEADERS)
590592
if OMPI_STANDARD_ABI
591593
include Makefile_abi.include
592594
endif

0 commit comments

Comments
 (0)