Skip to content

Commit

Permalink
Merge pull request #24 from jsquyres/pr/rename-l-to-x
Browse files Browse the repository at this point in the history
Rename _l to _x
  • Loading branch information
jsquyres authored Jul 26, 2019
2 parents 9f81d42 + 48e872e commit bcecbd7
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 83 deletions.
1 change: 0 additions & 1 deletion c/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ libmpi_la_SOURCES = \
comm_size.c \
finalize.c \
get_elements_int.c \
get_elements_count.c \
get_elements_x.c \
init.c \
recv_int.c \
Expand Down
2 changes: 1 addition & 1 deletion c/allgather_count.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "mpi.h"


int MPI_Allgather_l(const void *sendbuf, MPI_Count sendcount,
int MPI_Allgather_x(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype,
void *recvbuf, MPI_Count recvcount,
MPI_Datatype recvtype, MPI_Comm comm)
Expand Down
27 changes: 0 additions & 27 deletions c/get_elements_count.c

This file was deleted.

2 changes: 1 addition & 1 deletion c/recv_count.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "mpi.h"


int MPI_Recv_l(void *buf, MPI_Count count,
int MPI_Recv_x(void *buf, MPI_Count count,
MPI_Datatype datatype,
int source, int tag, MPI_Comm comm,
MPI_Status *status)
Expand Down
2 changes: 1 addition & 1 deletion c/send_count.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "mpi.h"


int MPI_Send_l(const void *buf, MPI_Count count,
int MPI_Send_x(const void *buf, MPI_Count count,
MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm)
{
Expand Down
59 changes: 46 additions & 13 deletions examples/example_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,18 @@ static void do_sends(void)
short smallI = 16;
MPI_Send(buffer, smallI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);

#if FROOZLE_HAVE_C11_GENERIC
printf(">> The following functions should call MPI_Send_l\n");
MPI_Count bigI = 8589934592;
#if FROOZLE_HAVE_C11_GENERIC
printf(">> The following functions should call MPI_Send_x\n");
MPI_Send(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);

// This one will generate a compiler warning (or error!) if you
// have no C11 _Generic support.
MPI_Send(buffer, 8589934592, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send(buffer, (MPI_Count) 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
#endif

// Let's also make sure that taking function pointers of both C
// functions work (i.e., the back-end MPI_Send function and the
// MPI_Send_l function).
// MPI_Send_x function).
typedef int (*int_fn_t)(const void *buf, int count,
MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm);
Expand All @@ -71,15 +69,23 @@ static void do_sends(void)

#if FROOZLE_HAVE_C11_GENERIC
// JMS Per the MPI Forum Virtual meeting on 2018-07-23, the
// MPI_Send_l function a) will be renamed MPI_Send_x, and b) will always
// MPI_Send_x function a) will be renamed MPI_Send_x, and b) will always
// be available, even if C11 _Generic isn't. A future pull request will
// make these changes.
printf(">> The following functions should call MPI_Send_l\n");
count_fn_t count_fn = MPI_Send_l;
printf(">> The following functions should call MPI_Send_x\n");
count_fn_t count_fn = MPI_Send_x;
count_fn(buffer, i, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
count_fn(buffer, smallI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
count_fn(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
#endif

printf(">> The following functions should call MPI_Send_x\n");
MPI_Send_x(buffer, i, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_x(buffer, 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_x(buffer, smallI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_x(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_x(buffer, 8589934592, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_x(buffer, (MPI_Count) 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
}

static void do_recvs(void)
Expand All @@ -94,9 +100,9 @@ static void do_recvs(void)
MPI_Recv(buffer, smallI, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);

#if FROOZLE_HAVE_C11_GENERIC
printf(">> The following functions should call MPI_Recv_l\n");
MPI_Count bigI = 8589934592;
#if FROOZLE_HAVE_C11_GENERIC
printf(">> The following functions should call MPI_Recv_x\n");
MPI_Recv(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);

Expand All @@ -105,6 +111,19 @@ static void do_recvs(void)
MPI_Recv(buffer, (MPI_Count) 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
#endif

printf(">> The following functions should call MPI_Recv_x\n");
MPI_Recv_x(buffer, i, MPI_CHAR, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
MPI_Recv_x(buffer, 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
MPI_Recv_x(buffer, smallI, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
MPI_Recv_x(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);

MPI_Recv_x(buffer, 8589934592, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
MPI_Recv_x(buffer, (MPI_Count) 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
}

static void do_allgathers(void)
Expand All @@ -121,16 +140,30 @@ static void do_allgathers(void)
MPI_Allgather(buffer, smallI, MPI_CHAR,
buffer, smallI, MPI_CHAR, MPI_COMM_WORLD);

#if FROOZLE_HAVE_C11_GENERIC
printf(">> The following functions should call MPI_Allgather_l\n");
MPI_Count bigI = 8589934592;
#if FROOZLE_HAVE_C11_GENERIC
printf(">> The following functions should call MPI_Allgather_x\n");
MPI_Allgather(buffer, bigI, MPI_CHAR,
buffer, bigI, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather(buffer, 8589934592, MPI_CHAR,
buffer, 8589934592, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather(buffer, (MPI_Count) 32, MPI_CHAR,
buffer, (MPI_Count) 32, MPI_CHAR, MPI_COMM_WORLD);
#endif

printf(">> The following functions should call MPI_Allgather_x\n");
MPI_Allgather_x(buffer, i, MPI_CHAR,
buffer, i, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather_x(buffer, 32, MPI_CHAR,
buffer, 32, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather_x(buffer, smallI, MPI_CHAR,
buffer, smallI, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather_x(buffer, bigI, MPI_CHAR,
buffer, bigI, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather_x(buffer, 8589934592, MPI_CHAR,
buffer, 8589934592, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather_x(buffer, (MPI_Count) 32, MPI_CHAR,
buffer, (MPI_Count) 32, MPI_CHAR, MPI_COMM_WORLD);
}

static void check_eq(MPI_Count a, MPI_Count b, int line)
Expand All @@ -155,7 +188,7 @@ static void do_get_elements(void)

MPI_Count count_c;
#if FROOZLE_HAVE_C11_GENERIC
printf(">> The following functions call MPI_Get_elements_l\n");
printf(">> The following functions call MPI_Get_elements_x\n");
MPI_Get_elements(MPI_STATUS_IGNORE, MPI_CHAR, &count_c);
CHECK_EQ(count_c, (MPI_Count) FROOZLE_TEST_SMALL_COUNT);
MPI_Get_elements(MPI_STATUS_IGNORE, MPI_INT, &count_c);
Expand Down
24 changes: 12 additions & 12 deletions examples/example_cxx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ static void do_sends(void)
short smallI = 16;
MPI_Send(buffer, smallI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);

printf(">> The following functions should call MPI_Send_l\n");
printf(">> The following functions should call MPI_Send_x\n");
MPI_Count bigI = 8589934592;
MPI_Send_l(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_l(buffer, 8589934592, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_l(buffer, (MPI_Count) 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_x(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_x(buffer, 8589934592, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
MPI_Send_x(buffer, (MPI_Count) 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
}

static void do_recvs(void)
Expand All @@ -52,13 +52,13 @@ static void do_recvs(void)
MPI_Recv(buffer, smallI, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);

printf(">> The following functions should call MPI_Recv_l\n");
printf(">> The following functions should call MPI_Recv_x\n");
MPI_Count bigI = 8589934592;
MPI_Recv_l(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_Recv_x(buffer, bigI, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
MPI_Recv_l(buffer, 8589934592, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_Recv_x(buffer, 8589934592, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
MPI_Recv_l(buffer, (MPI_Count) 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_Recv_x(buffer, (MPI_Count) 32, MPI_CHAR, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
}

Expand All @@ -76,13 +76,13 @@ static void do_allgathers(void)
MPI_Allgather(buffer, smallI, MPI_CHAR,
buffer, smallI, MPI_CHAR, MPI_COMM_WORLD);

printf(">> The following functions should call MPI_Allgather_l\n");
printf(">> The following functions should call MPI_Allgather_x\n");
MPI_Count bigI = 8589934592;
MPI_Allgather_l(buffer, bigI, MPI_CHAR,
MPI_Allgather_x(buffer, bigI, MPI_CHAR,
buffer, bigI, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather_l(buffer, 8589934592, MPI_CHAR,
MPI_Allgather_x(buffer, 8589934592, MPI_CHAR,
buffer, 8589934592, MPI_CHAR, MPI_COMM_WORLD);
MPI_Allgather_l(buffer, (MPI_Count) 32, MPI_CHAR,
MPI_Allgather_x(buffer, (MPI_Count) 32, MPI_CHAR,
buffer, (MPI_Count) 32, MPI_CHAR, MPI_COMM_WORLD);
}

Expand Down
6 changes: 3 additions & 3 deletions examples/example_usempif08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ subroutine do_sends()
call MPI_Send(buffer, 32, MPI_CHARACTER, 0, 0, MPI_COMM_WORLD, ierr)
call MPI_Send(buffer, i, MPI_CHARACTER, 0, 0, MPI_COMM_WORLD, ierr)

write(*,*) '>> The following functions should call MPI_Send_l'
write(*,*) '>> The following functions should call MPI_Send_x'
call MPI_Send(buffer, bigI, MPI_CHARACTER, 0, 0, MPI_COMM_WORLD, ierr)
call MPI_Send(buffer, 858993459_MPI_COUNT_KIND, MPI_CHARACTER, &
0, 0, MPI_COMM_WORLD, ierr)
Expand All @@ -41,7 +41,7 @@ subroutine do_recvs()
call MPI_Recv(buffer, i, MPI_CHARACTER, 0, 0, MPI_COMM_WORLD, &
MPI_STATUS_IGNORE, ierr)

write(*,*) '>> The following functions should call MPI_Recv_l'
write(*,*) '>> The following functions should call MPI_Recv_x'
call MPI_Recv(buffer, bigI, MPI_CHARACTER, 0, 0, MPI_COMM_WORLD, &
MPI_STATUS_IGNORE, ierr)
call MPI_Recv(buffer, 8589934592_MPI_COUNT_KIND, MPI_CHARACTER, &
Expand All @@ -65,7 +65,7 @@ subroutine do_allgathers()
call MPI_Allgather(buffer, i, MPI_CHARACTER, &
buffer, i, MPI_CHARACTER, &
MPI_COMM_WORLD, ierr)
write(*,*) '>> The following functions should call MPI_Allgather_l'
write(*,*) '>> The following functions should call MPI_Allgather_x'
call MPI_Allgather(buffer, bigI, MPI_CHARACTER, &
buffer, bigI, MPI_CHARACTER, &
MPI_COMM_WORLD, ierr)
Expand Down
6 changes: 3 additions & 3 deletions fortran-usempif08/allgather_count_usempif08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "froozle_config_fortran.h"

subroutine MPI_Allgather_l_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, &
subroutine MPI_Allgather_x_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, &
comm,ierror)
use :: mpi_f08_types
implicit none
Expand All @@ -16,7 +16,7 @@ subroutine MPI_Allgather_l_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recv
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror

write(*,*) 'This is mpi_f08 module MPI_Allgather_l_f08'
write(*,*) 'This is mpi_f08 module MPI_Allgather_x_f08'

if (present(ierror)) ierror = MPI_SUCCESS
end subroutine MPI_Allgather_l_f08
end subroutine MPI_Allgather_x_f08
12 changes: 6 additions & 6 deletions fortran-usempif08/mpi-f08-module.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module mpi_f08
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Allgather_f08

subroutine MPI_Allgather_l_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, &
subroutine MPI_Allgather_x_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, &
comm,ierror)
use :: mpi_f08_types
implicit none
Expand All @@ -98,7 +98,7 @@ module mpi_f08
TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Allgather_l_f08
end subroutine MPI_Allgather_x_f08
end interface MPI_Allgather

interface MPI_Send
Expand All @@ -113,7 +113,7 @@ module mpi_f08
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Send_f08

subroutine MPI_Send_l_f08(buf,count,datatype,dest,tag,comm,ierror)
subroutine MPI_Send_x_f08(buf,count,datatype,dest,tag,comm,ierror)
use :: mpi_f08_types
implicit none
@FROOZLE_FORTRAN_IGNORE_TKR_PREDECL@ buf
Expand All @@ -123,7 +123,7 @@ module mpi_f08
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Send_l_f08
end subroutine MPI_Send_x_f08
end interface MPI_Send

interface MPI_Recv
Expand All @@ -139,7 +139,7 @@ module mpi_f08
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Recv_f08

subroutine MPI_Recv_l_f08(buf,count,datatype,source,tag,comm,status,ierror)
subroutine MPI_Recv_x_f08(buf,count,datatype,source,tag,comm,status,ierror)
use :: mpi_f08_types
implicit none
@FROOZLE_FORTRAN_IGNORE_TKR_PREDECL@ buf
Expand All @@ -150,7 +150,7 @@ module mpi_f08
TYPE(MPI_Comm), INTENT(IN) :: comm
TYPE(MPI_Status) :: status
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Recv_l_f08
end subroutine MPI_Recv_x_f08
end interface MPI_Recv

! Back-end C function to do the work for MPI_Get_elements[_x]
Expand Down
6 changes: 3 additions & 3 deletions fortran-usempif08/recv_count_usempif08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "froozle_config_fortran.h"

subroutine MPI_Recv_l_f08(buf,count,datatype,source,tag,comm,status,ierror)
subroutine MPI_Recv_x_f08(buf,count,datatype,source,tag,comm,status,ierror)
use :: mpi_f08_types
implicit none
FROOZLE_FORTRAN_IGNORE_TKR_TYPE :: buf
Expand All @@ -16,8 +16,8 @@ subroutine MPI_Recv_l_f08(buf,count,datatype,source,tag,comm,status,ierror)
TYPE(MPI_Status) :: status
INTEGER, OPTIONAL, INTENT(OUT) :: ierror

write(*,*) 'This is mpi_f08 module MPI_Recv_l_f08'
write(*,*) 'This is mpi_f08 module MPI_Recv_x_f08'

status%MPI_SOURCE = 0
if (present(ierror)) ierror = MPI_SUCCESS
end subroutine MPI_Recv_l_f08
end subroutine MPI_Recv_x_f08
6 changes: 3 additions & 3 deletions fortran-usempif08/send_count_usempif08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "froozle_config_fortran.h"

subroutine MPI_Send_l_f08(buf,count,datatype,dest,tag,comm,ierror)
subroutine MPI_Send_x_f08(buf,count,datatype,dest,tag,comm,ierror)
use :: mpi_f08_types
implicit none
FROOZLE_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
Expand All @@ -15,7 +15,7 @@ subroutine MPI_Send_l_f08(buf,count,datatype,dest,tag,comm,ierror)
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror

write(*,*) 'This is mpi_f08 module MPI_Send_l_f08'
write(*,*) 'This is mpi_f08 module MPI_Send_x_f08'

if (present(ierror)) ierror = MPI_SUCCESS
end subroutine MPI_Send_l_f08
end subroutine MPI_Send_x_f08
2 changes: 1 addition & 1 deletion include/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mpi-config.h
mpi.h

froozle_config.h
froozle_config_fortran.h
Loading

0 comments on commit bcecbd7

Please sign in to comment.