Commit d101dd12 authored by Swann Perarnau's avatar Swann Perarnau

working version

parent d0d098a3
Pipeline #8667 failed with stages
in 31 minutes and 47 seconds
......@@ -25,3 +25,5 @@ m4/ltmain.sh
m4/missing
src/config.h.in
_output
*.trs
*.log
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src tests
SUBDIRS = src ctests ftests
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libnrm.pc
......
......@@ -42,7 +42,8 @@ AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_FILES([Makefile
src/Makefile
tests/Makefile
ctests/Makefile
ftests/Makefile
libnrm.pc
libf_nrm.pc])
AC_OUTPUT
AM_COLOR_TESTS = yes
if PMPI_API
TESTS_ENVIRONMENT= LD_PRELOAD=$(top_srcdir)/src/.libs/libnrm-pmpi.so \
ARGO_CONTAINER_UUID=argo \
ARGO_NRM_TRANSMIT=0
MPI_TESTS = mpi_basic mpi_collectives
endif
check_PROGRAMS = $(MPI_TESTS)
TESTS = $(MPI_TESTS)
AM_COLOR_TESTS = yes
MPI_TESTS =
#.o.f90:
AM_DEFAULT_SOURCE_EXT = .f90
if PMPI_API
TESTS_ENVIRONMENT= LD_PRELOAD=$(top_srcdir)/src/.libs/libnrm-pmpi.so \
ARGO_CONTAINER_UUID=toto \
ARGO_CONTAINER_UUID=argo \
ARGO_NRM_TRANSMIT=0
C_MPI_TESTS = cbasic
F_MPI_TESTS = fbasic
fbasic: fbasic.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -o $@ $(FCFLAGS_f90) $<
MPI_TESTS += $(C_MPI_TESTS) $(F_MPI_TESTS)
MPI_TESTS = mpi_basic mpi_collectives
endif
check_PROGRAMS = $(MPI_TESTS)
......
module test_collectives
use mpi
implicit none
contains
subroutine check_collectives(size, rank)
implicit none
integer, intent(in) :: size, rank
integer :: i, ierror
double precision, dimension(size) :: local, recv
double precision :: err
do i = 1, size
local(i) = rank
end do
call MPI_BARRIER(MPI_COMM_WORLD, ierror)
call MPI_ALLREDUCE(local, recv, size, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD, ierror)
do i = 1, size
err = recv(i) - ((size*(size-1))/2)
if(err > 1e-14) then
call exit(1)
endif
end do
end subroutine
end module test_collectives
program mpi_collectives
use test_collectives
implicit none
integer :: rank, size, ierror
call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror)
call check_collectives(size, rank)
call MPI_FINALIZE(ierror)
end
......@@ -14,15 +14,15 @@
#include <inttypes.h>
#include <stdlib.h>
void FC_FUNC_(mpi_allreduce, MPI_ALLREDUCE)(void **sendbuf, void **recvbuf,
void FC_FUNC_(mpi_allreduce, MPI_ALLREDUCE)(void *sendbuf, void *recvbuf,
MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op,
MPI_Fint *comm, MPI_Fint *ierror)
{
int cn = (int)*count;
MPI_Datatype dt = MPI_Type_f2c(datatype);
MPI_Op o = MPI_Op_f2c(op);
MPI_Comm cc = MPI_Comm_f2c(comm);
*ierror = (MPI_Fint)NRM_MPI_INNER_NAME(MPI_Allreduce, *sendbuf, *recvbuf,
MPI_Datatype dt = MPI_Type_f2c(*datatype);
MPI_Op o = MPI_Op_f2c(*op);
MPI_Comm cc = MPI_Comm_f2c(*comm);
*ierror = (MPI_Fint)NRM_MPI_INNER_NAME(MPI_Allreduce, sendbuf, recvbuf,
cn, dt, o, cc);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment