From 35b51e4fc37a636c096224e67ac51572f47a35f6 Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Thu, 6 Jan 2022 22:34:27 +0100
Subject: [PATCH] Cleanup of laxlib tests: use laxlib_parallel_include instead
of module mpi, not always compiled for the same compiler. Closes issue 380.
---
LAXlib/tests/Makefile | 2 +-
LAXlib/tests/mp_world.f90 | 4 +---
LAXlib/tests/test_diaghg_1.f90 | 5 ++---
LAXlib/tests/test_diaghg_2.f90 | 5 ++---
LAXlib/tests/test_diaghg_3.f90 | 5 ++---
LAXlib/tests/test_diaghg_4.f90 | 7 +++----
LAXlib/tests/test_diaghg_gpu_1.f90 | 5 ++---
LAXlib/tests/test_diaghg_gpu_2.f90 | 5 ++---
LAXlib/tests/test_diaghg_gpu_3.f90 | 5 ++---
LAXlib/tests/test_diaghg_gpu_4.f90 | 7 +++----
LAXlib/tests/utils.f90 | 10 ++++------
11 files changed, 24 insertions(+), 36 deletions(-)
diff --git a/LAXlib/tests/Makefile b/LAXlib/tests/Makefile
index 853d64a75..6d031a5f3 100644
--- a/LAXlib/tests/Makefile
+++ b/LAXlib/tests/Makefile
@@ -2,7 +2,7 @@
include ../../make.inc
-MODFLAGS= $(MOD_FLAG)../../UtilXlib $(MOD_FLAG)../../ELPA/src $(MOD_FLAG).. $(MOD_FLAG).
+MODFLAGS= $(MOD_FLAG)../../UtilXlib $(MOD_FLAG).. $(MOD_FLAG).
SRCS = test_diaghg_1.f90 \
test_diaghg_2.f90 \
diff --git a/LAXlib/tests/mp_world.f90 b/LAXlib/tests/mp_world.f90
index 0be06d43f..157feabe2 100644
--- a/LAXlib/tests/mp_world.f90
+++ b/LAXlib/tests/mp_world.f90
@@ -2,9 +2,7 @@
MODULE mp_world
!----------------------------------------------------------------------------
!
-#if defined(__MPI)
- USE mpi
-#endif
+ USE laxlib_parallel_include
USE mp, ONLY : mp_barrier, mp_start, mp_end, mp_stop
USE mp, ONLY : mp_count_nodes
!
diff --git a/LAXlib/tests/test_diaghg_1.f90 b/LAXlib/tests/test_diaghg_1.f90
index 2f75ff0f0..378ff4a68 100644
--- a/LAXlib/tests/test_diaghg_1.f90
+++ b/LAXlib/tests/test_diaghg_1.f90
@@ -1,7 +1,6 @@
program test_diaghg
-#if defined(__MPI)
- USE MPI
-#endif
+
+ USE laxlib_parallel_include
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, world_comm
diff --git a/LAXlib/tests/test_diaghg_2.f90 b/LAXlib/tests/test_diaghg_2.f90
index 664ae81ac..17f6999b5 100644
--- a/LAXlib/tests/test_diaghg_2.f90
+++ b/LAXlib/tests/test_diaghg_2.f90
@@ -1,7 +1,6 @@
program test_diaghg_2
-#if defined(__MPI)
- USE MPI
-#endif
+
+ USE laxlib_parallel_include
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, world_comm
diff --git a/LAXlib/tests/test_diaghg_3.f90 b/LAXlib/tests/test_diaghg_3.f90
index 6802e714a..3678d5660 100644
--- a/LAXlib/tests/test_diaghg_3.f90
+++ b/LAXlib/tests/test_diaghg_3.f90
@@ -1,7 +1,6 @@
program test_diaghg_3
-#if defined(__MPI)
- USE MPI
-#endif
+
+ USE laxlib_parallel_include
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, world_comm
diff --git a/LAXlib/tests/test_diaghg_4.f90 b/LAXlib/tests/test_diaghg_4.f90
index 6b4d56f04..62b82abc4 100644
--- a/LAXlib/tests/test_diaghg_4.f90
+++ b/LAXlib/tests/test_diaghg_4.f90
@@ -8,13 +8,12 @@
! - SiGeK1.bin
! - SiGeK2.bin
!
-! If the scalacpak or ELPA driver is used, the test is skipped.
+! If the scalapack or ELPA driver is used, the test is skipped.
!
#if ! defined(__SCALAPACK)
program test_diaghg_4
-#if defined(__MPI)
- USE MPI
-#endif
+
+ USE laxlib_parallel_include
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, world_comm
diff --git a/LAXlib/tests/test_diaghg_gpu_1.f90 b/LAXlib/tests/test_diaghg_gpu_1.f90
index e4095ff05..f31c46bb9 100644
--- a/LAXlib/tests/test_diaghg_gpu_1.f90
+++ b/LAXlib/tests/test_diaghg_gpu_1.f90
@@ -1,8 +1,7 @@
#if defined(__CUDA)
program test_diaghg_gpu
-#if defined(__MPI)
- USE MPI
-#endif
+
+ USE laxlib_parallel_include
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
diff --git a/LAXlib/tests/test_diaghg_gpu_2.f90 b/LAXlib/tests/test_diaghg_gpu_2.f90
index fcd0544ee..832824a7c 100644
--- a/LAXlib/tests/test_diaghg_gpu_2.f90
+++ b/LAXlib/tests/test_diaghg_gpu_2.f90
@@ -1,8 +1,7 @@
#if defined(__CUDA)
program test_diaghg_gpu_2
-#if defined(__MPI)
- USE MPI
-#endif
+
+ USE laxlib_parallel_include
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
diff --git a/LAXlib/tests/test_diaghg_gpu_3.f90 b/LAXlib/tests/test_diaghg_gpu_3.f90
index 5fe74b20a..e936a93cb 100644
--- a/LAXlib/tests/test_diaghg_gpu_3.f90
+++ b/LAXlib/tests/test_diaghg_gpu_3.f90
@@ -1,8 +1,7 @@
#ifdef __CUDA
program test_diaghg_gpu_3
-#if defined(__MPI)
- USE MPI
-#endif
+
+ USE laxlib_parallel_include
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
diff --git a/LAXlib/tests/test_diaghg_gpu_4.f90 b/LAXlib/tests/test_diaghg_gpu_4.f90
index 6618e0fab..0213cff09 100644
--- a/LAXlib/tests/test_diaghg_gpu_4.f90
+++ b/LAXlib/tests/test_diaghg_gpu_4.f90
@@ -8,13 +8,12 @@
! - SiGeK1.bin
! - SiGeK2.bin
!
-! If the scalacpak or ELPA driver is used, the test is skipped.
+! If the scalapack or ELPA driver is used, the test is skipped.
!
#if ( ! defined(__SCALAPACK) ) && defined(__CUDA)
program test_diaghg_gpu_4
-#if defined(__MPI)
- USE MPI
-#endif
+
+ USE laxlib_parallel_include
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mp_world_start, mp_world_end, mpime, &
root, nproc, world_comm
diff --git a/LAXlib/tests/utils.f90 b/LAXlib/tests/utils.f90
index 9f34122dc..38ef40ea7 100644
--- a/LAXlib/tests/utils.f90
+++ b/LAXlib/tests/utils.f90
@@ -1,7 +1,6 @@
SUBROUTINE collect_results(test)
-#if defined(__MPI)
- USE mpi
-#endif
+
+ USE laxlib_parallel_include
USE tester
IMPLICIT NONE
!
@@ -34,9 +33,8 @@ END SUBROUTINE collect_results
SUBROUTINE no_test
-#if defined(__MPI)
- USE mpi
-#endif
+
+ USE laxlib_parallel_include
USE tester
IMPLICIT NONE
!TYPE(tester_t) :: test