From 7540c6ffc0e01f8750a8aa1ebbb84cbebd2f2bf1 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Thu, 22 Feb 2024 11:43:25 +0100 Subject: [PATCH] [Debug] Test Fortran library with non-mpi Signed-off-by: Cristian Le --- test-suite/libv2-demo/CMakeLists.txt | 2 +- .../{lib-gas-opt-pllel => lib-gas-opt}/CMakeLists.txt | 5 ++++- .../demo.f90 => lib-gas-opt/demo.F90} | 11 +++++++++++ .../{lib-gas-opt-pllel => lib-gas-opt}/gaas.amn | 0 .../{lib-gas-opt-pllel => lib-gas-opt}/gaas.eig | 0 .../{lib-gas-opt-pllel => lib-gas-opt}/gaas.mmn | 0 .../{lib-gas-opt-pllel => lib-gas-opt}/makefile | 2 +- 7 files changed, 17 insertions(+), 3 deletions(-) rename test-suite/libv2-demo/{lib-gas-opt-pllel => lib-gas-opt}/CMakeLists.txt (60%) rename test-suite/libv2-demo/{lib-gas-opt-pllel/demo.f90 => lib-gas-opt/demo.F90} (96%) rename test-suite/libv2-demo/{lib-gas-opt-pllel => lib-gas-opt}/gaas.amn (100%) rename test-suite/libv2-demo/{lib-gas-opt-pllel => lib-gas-opt}/gaas.eig (100%) rename test-suite/libv2-demo/{lib-gas-opt-pllel => lib-gas-opt}/gaas.mmn (100%) rename test-suite/libv2-demo/{lib-gas-opt-pllel => lib-gas-opt}/makefile (75%) diff --git a/test-suite/libv2-demo/CMakeLists.txt b/test-suite/libv2-demo/CMakeLists.txt index dfdc9654b..0d4178209 100644 --- a/test-suite/libv2-demo/CMakeLists.txt +++ b/test-suite/libv2-demo/CMakeLists.txt @@ -3,7 +3,7 @@ set_property(DIRECTORY APPEND ) set(test_names - lib-gas-opt-pllel + lib-gas-opt libc-gas-mix-serial libc-gas-mix-serial-clash ) diff --git a/test-suite/libv2-demo/lib-gas-opt-pllel/CMakeLists.txt b/test-suite/libv2-demo/lib-gas-opt/CMakeLists.txt similarity index 60% rename from test-suite/libv2-demo/lib-gas-opt-pllel/CMakeLists.txt rename to test-suite/libv2-demo/lib-gas-opt/CMakeLists.txt index c29fffba1..37ab722a3 100644 --- a/test-suite/libv2-demo/lib-gas-opt-pllel/CMakeLists.txt +++ b/test-suite/libv2-demo/lib-gas-opt/CMakeLists.txt @@ -3,5 +3,8 @@ project(demo_Wannier90 LANGUAGES Fortran) find_package(Wannier90 REQUIRED) -add_executable(demo demo.f90) +add_executable(demo demo.F90) +if (Wannier90_MPI) + target_compile_definitions(demo PRIVATE Wannier90_MPI) +endif () target_link_libraries(demo PRIVATE Wannier90::wannier90) diff --git a/test-suite/libv2-demo/lib-gas-opt-pllel/demo.f90 b/test-suite/libv2-demo/lib-gas-opt/demo.F90 similarity index 96% rename from test-suite/libv2-demo/lib-gas-opt-pllel/demo.f90 rename to test-suite/libv2-demo/lib-gas-opt/demo.F90 index 7743fa5f0..0b80d1521 100644 --- a/test-suite/libv2-demo/lib-gas-opt-pllel/demo.f90 +++ b/test-suite/libv2-demo/lib-gas-opt/demo.F90 @@ -1,5 +1,7 @@ program ok +#ifdef Wannier90_MPI use mpi_f08 +#endif use w90_library implicit none @@ -18,6 +20,11 @@ program ok real(8) :: uccart(3, 3) ! cartesian unit cell type(lib_common_type), target :: w90main +#ifndef Wannier90_MPI + ! MPI dummy + integer :: mpi_comm_world = 0 +#endif + ! collect data nb = 12 nw = 8 @@ -58,10 +65,12 @@ program ok enddo enddo +#ifdef Wannier90_MPI ! setup MPI call mpi_init(ierr) call mpi_comm_size(mpi_comm_world, mpisize, ierr) call mpi_comm_rank(mpi_comm_world, mpirank, ierr) +#endif ! crude k distribution allocate (distk(nk)) @@ -125,5 +134,7 @@ program ok write (stdout, '(4f20.10)') (w90main%wannier_data%centres(ic, ib), ic=1, 3), w90main%wannier_data%spreads(ib) enddo endif +#ifdef Wannier90_MPI call mpi_finalize() +#endif end program diff --git a/test-suite/libv2-demo/lib-gas-opt-pllel/gaas.amn b/test-suite/libv2-demo/lib-gas-opt/gaas.amn similarity index 100% rename from test-suite/libv2-demo/lib-gas-opt-pllel/gaas.amn rename to test-suite/libv2-demo/lib-gas-opt/gaas.amn diff --git a/test-suite/libv2-demo/lib-gas-opt-pllel/gaas.eig b/test-suite/libv2-demo/lib-gas-opt/gaas.eig similarity index 100% rename from test-suite/libv2-demo/lib-gas-opt-pllel/gaas.eig rename to test-suite/libv2-demo/lib-gas-opt/gaas.eig diff --git a/test-suite/libv2-demo/lib-gas-opt-pllel/gaas.mmn b/test-suite/libv2-demo/lib-gas-opt/gaas.mmn similarity index 100% rename from test-suite/libv2-demo/lib-gas-opt-pllel/gaas.mmn rename to test-suite/libv2-demo/lib-gas-opt/gaas.mmn diff --git a/test-suite/libv2-demo/lib-gas-opt-pllel/makefile b/test-suite/libv2-demo/lib-gas-opt/makefile similarity index 75% rename from test-suite/libv2-demo/lib-gas-opt-pllel/makefile rename to test-suite/libv2-demo/lib-gas-opt/makefile index 25571f211..16ef2e4e2 100644 --- a/test-suite/libv2-demo/lib-gas-opt-pllel/makefile +++ b/test-suite/libv2-demo/lib-gas-opt/makefile @@ -5,5 +5,5 @@ XLIBS=$(ROOT)/libwan2.a a.out: demo.o $(MPIF90) demo.o $(LIBS) $(XLIBS) demo.o: demo.f90 - $(MPIF90) $(FCOPTS) $(XINCS) -c $< + $(MPIF90) $(FCOPTS) -DWannier90_MPI $(XINCS) -c $<