abi: treat MPI_File the same way as other handle types

Now that we added explicit conversion routines for MPI_File
(ABI_File_{from,to}_mpi), we should treat MPI_File the same way as other
MPI handle types.
Esse commit está contido em:
Hui Zhou
2024-04-29 11:52:06 -05:00
commit 3eeaa52089
3 arquivos alterados com 8 adições e 14 exclusões
+3 -8
Ver Arquivo
@@ -35,7 +35,7 @@ def load_mpi_abi_h(mpi_abi_h):
def dump_mpi_abi_internal_h(mpi_abi_internal_h):
define_constants = {}
def gen_mpi_abi_internal_h(out):
re_Handle = r'\bMPI_(Comm|Datatype|Errhandler|Group|Info|Message|Op|Request|Session|Win|KEYVAL_INVALID|TAG_UB|IO|HOST|WTIME_IS_GLOBAL|APPNUM|LASTUSEDCODE|UNIVERSE_SIZE|WIN_BASE|WIN_DISP_UNIT|WIN_SIZE|WIN_CREATE_FLAVOR|WIN_MODEL)\b'
re_Handle = r'\bMPI_(Comm|Datatype|Errhandler|Group|Info|Message|Op|Request|Session|Win|File|KEYVAL_INVALID|TAG_UB|IO|HOST|WTIME_IS_GLOBAL|APPNUM|LASTUSEDCODE|UNIVERSE_SIZE|WIN_BASE|WIN_DISP_UNIT|WIN_SIZE|WIN_CREATE_FLAVOR|WIN_MODEL)\b'
for line in G.abi_h_lines:
if RE.search(r'MPI_ABI_H_INCLUDED', line):
# skip the include guard, harmless
@@ -58,13 +58,8 @@ def dump_mpi_abi_internal_h(mpi_abi_internal_h):
elif T == "MPI_Op":
idx = int(val, 0) & G.op_mask
G.abi_ops[idx] = name
if T == "MPI_File":
# pass through
out.append(line.rstrip())
else:
# replace param prefix
out.append(re.sub(r'\bMPI_', 'ABI_', line.rstrip()))
# replace param prefix
out.append(re.sub(r'\bMPI_', 'ABI_', line.rstrip()))
elif RE.match(r'#define MPI_(LONG_LONG|C_COMPLEX)', line):
# datatype aliases
out.append(re.sub(r'\bMPI_', 'ABI_', line.rstrip()))
+5 -4
Ver Arquivo
@@ -1047,11 +1047,12 @@ def dump_abi_wrappers(func, is_large):
return True
return False
# ----
re_Handle = r'MPI_(Comm|Datatype|Errhandler|Group|Info|Message|Op|Request|Session|Win|File)\b'
for p in func['c_parameters']:
skip_abi_swap = False
param_type = mapping[p['kind']]
name = p['name']
if RE.match(r'MPI_(Comm|Datatype|Errhandler|Group|Info|Message|Op|Request|Session|Win)\b', param_type):
if RE.match(re_Handle, param_type):
process_handle(p)
elif p['kind'] == 'KEYVAL' and p['param_direction'] == 'in':
pre_filters.append("int %s = ABI_KEYVAL_to_mpi(%s_abi);" % (name, name))
@@ -1070,7 +1071,7 @@ def dump_abi_wrappers(func, is_large):
# MPI_Comm comm -> ABI_Comm comm_abi
param = get_C_param(p, func, mapping)
param = re.sub(r'MPI_(Comm|Datatype|Errhandler|Group|Info|Message|Op|Request|Session|Win)\b', r'ABI_\1', param)
param = re.sub(re_Handle, r'ABI_\1', param)
if not skip_abi_swap:
param = re.sub(r'\b' + name, name+"_abi", param)
param_list.append(param)
@@ -1081,7 +1082,7 @@ def dump_abi_wrappers(func, is_large):
ret = "int"
if 'return' in func:
ret = mapping[func['return']]
ret = re.sub(r'MPI_(Comm|Datatype|Errhandler|Group|Info|Message|Op|Request|Session|Win)\b', r'ABI_\1', ret)
ret = re.sub(re_Handle, r'ABI_\1', ret)
static_call = get_static_call_internal(func, is_large)
@@ -1098,7 +1099,7 @@ def dump_abi_wrappers(func, is_large):
if ret != 'int':
# MPI_Wtime, MPI_Aint_{add,diff}, MPI_{Comm,...}_{c2f,f2c}
if RE.match(r'..._(Comm|Datatype|Errhandler|Group|Info|Message|Op|Request|Session|Win)\b', ret):
if RE.match(r'..._(Comm|Datatype|Errhandler|Group|Info|Message|Op|Request|Session|Win|File)\b', ret):
G.out.append("return ABI_%s_from_mpi(%s);" % (RE.m.group(1), static_call))
else:
G.out.append("return " + static_call + ";")
-2
Ver Arquivo
@@ -271,7 +271,6 @@ typedef int MPI_Win;
typedef int MPI_Session;
#define MPI_SESSION_NULL ((MPI_Session)0x38000000)
#ifndef BUILD_MPI_ABI
/* File and IO */
/* This define lets ROMIO know that MPI_File has been defined */
#define MPI_FILE_DEFINED
@@ -279,7 +278,6 @@ typedef int MPI_Session;
as in src/mpi/romio/include/mpio.h.in */
typedef struct ADIOI_FileD *MPI_File;
#define MPI_FILE_NULL ((MPI_File)0)
#endif
/* Collective operations */
typedef int MPI_Op;