Skip to content

Commit f5c1a4c

Browse files
committed
Clean up
1 parent de3a399 commit f5c1a4c

1 file changed

Lines changed: 7 additions & 46 deletions

File tree

src/mpi.c

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -297,39 +297,6 @@ static void set_status_count(MPI_Status *status, MPI_Count count_in_bytes) {
297297
}
298298
}
299299

300-
// static MPI_Count get_status_count_impl(const MPI_Status *status) {
301-
// MPI_Count count_in_bytes = 0;
302-
// if (status && status != MPI_STATUS_IGNORE) {
303-
// safe_memcpy(&count_in_bytes, &status->MPI_internal[0], sizeof(MPI_Count));
304-
// }
305-
// return count_in_bytes;
306-
// }
307-
308-
// int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count) {
309-
// if(count && status && status != MPI_STATUS_IGNORE) {
310-
// MPI_Count bytes_received = get_status_count_impl(status);
311-
// MPI_Count type_sz = get_type_size(datatype);
312-
// *count = (int)(type_sz > 0 ? bytes_received / type_sz : 0);
313-
// }
314-
// return MPI_SUCCESS;
315-
// }
316-
317-
// int MPI_Get_count_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count) {
318-
// if(count && status && status != MPI_STATUS_IGNORE) {
319-
// MPI_Count bytes_received = get_status_count_impl(status);
320-
// MPI_Count type_sz = get_type_size(datatype);
321-
// *count = type_sz > 0 ? bytes_received / type_sz : 0;
322-
// }
323-
// return MPI_SUCCESS;
324-
// }
325-
326-
// int MPI_Get_elements_c(const MPI_Status *status, MPI_Datatype datatype, MPI_Count *count) {
327-
// return MPI_Get_count_c(status, datatype, count);
328-
// }
329-
// int MPI_Get_elements(const MPI_Status *status, MPI_Datatype datatype, int *count) {
330-
// return MPI_Get_count(status, datatype, count);
331-
// }
332-
333300
/* Safely extract 64-bit payload from the status array */
334301
static MPI_Count get_status_count_impl(const MPI_Status *status) {
335302
MPI_Count count_in_bytes = 0;
@@ -957,7 +924,7 @@ int MPI_Type_create_hvector_c(MPI_Count count, MPI_Count blocklength, MPI_Count
957924
if (id >= HANDLE_OFFSET && id < MAX_CUSTOM_TYPES) {
958925
custom_type_sizes[id] = count * blocklength * get_type_size(oldtype);
959926
custom_type_lbs[id] = get_type_lb(oldtype);
960-
/* FIX: Only calculate extent if count AND blocklength are valid */
927+
/* Only calculate extent if count AND blocklength are valid */
961928
custom_type_extents[id] = (count > 0 && blocklength > 0) ? (stride * (count - 1) + blocklength * get_type_extent(oldtype)) : 0;
962929
}
963930
}
@@ -1047,7 +1014,7 @@ int MPI_Type_create_resized_c(MPI_Datatype oldtype, MPI_Count lb, MPI_Count exte
10471014
custom_type_sizes[id] = get_type_size(oldtype);
10481015
custom_type_lbs[id] = lb;
10491016
custom_type_extents[id] = extent;
1050-
custom_type_true_lbs[id] = get_type_true_lb(oldtype); /* <--- PRESERVE TRUE_LB */
1017+
custom_type_true_lbs[id] = get_type_true_lb(oldtype);
10511018
}
10521019
}
10531020
return MPI_SUCCESS;
@@ -1058,7 +1025,7 @@ int MPI_Type_create_struct_c(MPI_Count count, const MPI_Count array_of_blockleng
10581025
int id = allocate_type_id(); *newtype = (MPI_Datatype)(intptr_t)id;
10591026
if (id >= HANDLE_OFFSET && id < MAX_CUSTOM_TYPES) {
10601027
MPI_Aint min_lb = 0, max_ub = 0; int has_lb = 0, has_ub = 0;
1061-
MPI_Aint min_true_lb = 0; int has_true = 0; /* <--- ADD THIS */
1028+
MPI_Aint min_true_lb = 0; int has_true = 0;
10621029
MPI_Count packed_size = 0;
10631030

10641031
for(int i=0; i<count; i++) {
@@ -1097,7 +1064,7 @@ int MPI_Type_create_struct(int count, const int array_of_blocklengths[], const M
10971064
int id = allocate_type_id(); *newtype = (MPI_Datatype)(intptr_t)id;
10981065
if (id >= HANDLE_OFFSET && id < MAX_CUSTOM_TYPES) {
10991066
MPI_Aint min_lb = 0, max_ub = 0; int has_lb = 0, has_ub = 0;
1100-
MPI_Aint min_true_lb = 0; int has_true = 0; /* <--- ADD THIS */
1067+
MPI_Aint min_true_lb = 0; int has_true = 0;
11011068
MPI_Count packed_size = 0;
11021069

11031070
for(int i=0; i<count; i++) {
@@ -2240,7 +2207,7 @@ int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info,
22402207
if (fd < MAX_FD) {
22412208
file_views[fd] = 0;
22422209
file_etypes[fd] = 1;
2243-
file_view_lbs[fd] = 0; /* <--- Initialize to 0 */
2210+
file_view_lbs[fd] = 0;
22442211
}
22452212
if (fh) *fh = (MPI_File)(intptr_t)(fd + FILE_HANDLE_OFFSET);
22462213
return MPI_SUCCESS;
@@ -2260,15 +2227,15 @@ int MPI_File_delete(const char *filename, MPI_Info info) {
22602227
return MPI_SUCCESS;
22612228
}
22622229

2263-
static MPI_Aint file_view_true_lbs[MAX_FD] = {0}; /* <--- Rename / Add this */
2230+
static MPI_Aint file_view_true_lbs[MAX_FD] = {0};
22642231

22652232
int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, const char *datarep, MPI_Info info) {
22662233
int fd = (int)(intptr_t)fh - FILE_HANDLE_OFFSET;
22672234
if (fd >= 0 && fd < MAX_FD) {
22682235
file_views[fd] = disp;
22692236
size_t etsz = get_type_size(etype);
22702237
file_etypes[fd] = etsz > 0 ? etsz : 1;
2271-
file_view_true_lbs[fd] = get_type_true_lb(filetype); /* <--- Use True LB */
2238+
file_view_true_lbs[fd] = get_type_true_lb(filetype);
22722239
}
22732240
lseek(fd, disp + file_view_true_lbs[fd], SEEK_SET);
22742241
return MPI_SUCCESS;
@@ -2434,8 +2401,6 @@ int MPI_File_get_atomicity(MPI_File fh, int *flag) { if(flag) *flag=0; return MP
24342401
int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp) { if(disp) *disp=offset; return MPI_SUCCESS; }
24352402
int MPI_File_get_group(MPI_File fh, MPI_Group *group) { if(group) *group=MPI_GROUP_NULL; return MPI_SUCCESS; }
24362403
int MPI_File_get_info(MPI_File fh, MPI_Info *info_used) { if(info_used) *info_used=MPI_INFO_NULL; return MPI_SUCCESS; }
2437-
// int MPI_File_get_type_extent_c(MPI_File fh, MPI_Datatype datatype, MPI_Count *extent) { if(extent) *extent=get_type_size(datatype); return MPI_SUCCESS; }
2438-
// int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent) { if(extent) *extent=get_type_size(datatype); return MPI_SUCCESS; }
24392404
int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype, char *datarep) { return MPI_SUCCESS; }
24402405
int MPI_File_preallocate(MPI_File fh, MPI_Offset size) { return MPI_File_set_size(fh, size); }
24412406
int MPI_File_read_all_begin_c(MPI_File fh, void *buf, MPI_Count count, MPI_Datatype datatype) { return MPI_SUCCESS; }
@@ -2630,15 +2595,11 @@ int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size) {
26302595
}
26312596
int MPI_Keyval_create(MPI_Copy_function *copy_fn, MPI_Delete_function *delete_fn, int *keyval, void *extra_state) { if(keyval) *keyval=next_keyval++; return MPI_SUCCESS; }
26322597
int MPI_Keyval_free(int *keyval) { if(keyval) *keyval=MPI_KEYVAL_INVALID; return MPI_SUCCESS; }
2633-
// int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count count) { set_status_count(status, count); return MPI_SUCCESS; }
2634-
// int MPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent) { if(lb) *lb=0; if(extent) *extent=get_type_size(datatype); return MPI_SUCCESS; }
2635-
// int MPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent) { return MPI_Type_get_extent_x(datatype, true_lb, true_extent); }
26362598
int MPI_Type_get_value_index(MPI_Datatype datatype, MPI_Datatype *value_type, MPI_Datatype *index_type) {
26372599
if(value_type) *value_type = MPI_DATATYPE_NULL;
26382600
if(index_type) *index_type = MPI_DATATYPE_NULL;
26392601
return MPI_SUCCESS;
26402602
}
2641-
// int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size) { if(size) *size=get_type_size(datatype); return MPI_SUCCESS; }
26422603

26432604
/* Legacy MPI-1 Aliases for SuperLU_DIST and MUMPS */
26442605
int MPI_Type_struct(int count, const int array_of_blocklengths[], const MPI_Aint array_of_displacements[], const MPI_Datatype array_of_types[], MPI_Datatype *newtype) {

0 commit comments

Comments
 (0)