Commit 734ab46b authored by Lorenz Huedepohl's avatar Lorenz Huedepohl

Merge branch 'master_pre_stage' of https://gitlab.mpcdf.mpg.de/elpa/elpa

parents f52e77d9 9e0fc71c
......@@ -28,7 +28,7 @@ for the documentation how to proceed.
*ELPA* can be installed with the build steps
- configure
- make
- make check
- make check | or make check CHECK_LEVEL=extended
- make install
Please look at configure --help for all available options.
......
......@@ -556,26 +556,26 @@ include legacy_test_programs.am
endif
noinst_PROGRAMS += double_instance@SUFFIX@
check_SCRIPTS += double_instance@SUFFIX@.sh
check_SCRIPTS += double_instance@SUFFIX@_default.sh
double_instance@SUFFIX@_SOURCES = test/Fortran/elpa2/double_instance.F90
double_instance@SUFFIX@_LDADD = $(test_program_ldadd)
double_instance@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) $(FC_MODINC)test_modules $(FC_MODINC)modules
noinst_PROGRAMS += real_2stage_banded@SUFFIX@
check_SCRIPTS += real_2stage_banded@SUFFIX@.sh
check_SCRIPTS += real_2stage_banded@SUFFIX@_default.sh
real_2stage_banded@SUFFIX@_SOURCES = test/Fortran/elpa2/real_2stage_banded.F90
real_2stage_banded@SUFFIX@_LDADD = $(test_program_ldadd)
real_2stage_banded@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) $(FC_MODINC)test_modules $(FC_MODINC)modules
noinst_PROGRAMS += complex_2stage_banded@SUFFIX@
check_SCRIPTS += complex_2stage_banded@SUFFIX@.sh
check_SCRIPTS += complex_2stage_banded@SUFFIX@_default.sh
complex_2stage_banded@SUFFIX@_SOURCES = test/Fortran/elpa2/complex_2stage_banded.F90
complex_2stage_banded@SUFFIX@_LDADD = $(test_program_ldadd)
complex_2stage_banded@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) $(FC_MODINC)test_modules $(FC_MODINC)modules
if WANT_SINGLE_PRECISION_REAL
noinst_PROGRAMS += single_real_2stage_banded@SUFFIX@
check_SCRIPTS += single_real_2stage_banded@SUFFIX@.sh
check_SCRIPTS += single_real_2stage_banded@SUFFIX@_default.sh
single_real_2stage_banded@SUFFIX@_SOURCES = test/Fortran/elpa2/single_real_2stage_banded.F90
single_real_2stage_banded@SUFFIX@_LDADD = $(test_program_ldadd)
single_real_2stage_banded@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) $(FC_MODINC)test_modules $(FC_MODINC)modules
......@@ -583,14 +583,14 @@ endif
if WANT_SINGLE_PRECISION_COMPLEX
noinst_PROGRAMS += single_complex_2stage_banded@SUFFIX@
check_SCRIPTS += single_complex_2stage_banded@SUFFIX@.sh
check_SCRIPTS += single_complex_2stage_banded@SUFFIX@_default.sh
single_complex_2stage_banded@SUFFIX@_SOURCES = test/Fortran/elpa2/single_complex_2stage_banded.F90
single_complex_2stage_banded@SUFFIX@_LDADD = $(test_program_ldadd)
single_complex_2stage_banded@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) $(FC_MODINC)test_modules $(FC_MODINC)modules
endif
# test scriptsT
# test scripts
TASKS ?= 2
if WITH_MPI
wrapper=$(MPI_BINARY) -n $${TASKS:-$(TASKS)}
......@@ -598,7 +598,12 @@ else
wrapper=
endif
TESTS = $(check_SCRIPTS)
%.sh: %
%_extended.sh: %
@echo "#!/bin/bash" > $@
@echo 'if [ "$$CHECK_LEVEL" = "extended" ] ; then $(wrapper) ./$^ $$TEST_FLAGS ; else exit 77; fi' >> $@
@chmod +x $@
%_default.sh: %
@echo "#!/bin/bash" > $@
@echo '$(wrapper)' ./$^ '$$TEST_FLAGS' >> $@
@chmod +x $@
......
......@@ -14,7 +14,7 @@ coverage](https://gitlab.mpcdf.mpg.de/elpa/badges/master/coverage.svg)](http://e
[![License: LGPL v3][license-badge]](LICENSE)
[license-badge]: https://img.shields.io/badge/License-LGPL%20v3-blue.svg
aa About *ELPA*
## About *ELPA* ##
The computation of selected or all eigenvalues and eigenvectors of a symmetric
(Hermitian) matrix has high relevance for various scientific disciplines.
......
This diff is collapsed.
noinst_PROGRAMS += \
real_2stage_c_version@SUFFIX@ \
autotune_c_version@SUFFIX@ \
legacy_real_1stage@SUFFIX@ \
legacy_complex_1stage@SUFFIX@ \
legacy_real_2stage@SUFFIX@ \
......@@ -74,14 +72,6 @@ noinst_PROGRAMS += \
endif
endif
real_2stage_c_version@SUFFIX@_SOURCES = test/C/real_2stage_c_version.c
real_2stage_c_version@SUFFIX@_LDADD = $(test_program_ldadd) $(FCLIBS)
real_2stage_c_version@SUFFIX@_FCFLAGS = $(test_program_fcflags)
autotune_c_version@SUFFIX@_SOURCES = test/C/autotune_c_version.c
autotune_c_version@SUFFIX@_LDADD = $(test_program_ldadd) $(FCLIBS)
autotune_c_version@SUFFIX@_FCFLAGS = $(test_program_fcflags)
legacy_real_1stage_c_version@SUFFIX@_SOURCES = test/C/elpa1/legacy_interface/legacy_real_1stage_c_version.c
legacy_real_1stage_c_version@SUFFIX@_LDADD = $(test_program_ldadd) $(FCLIBS)
legacy_real_1stage_c_version@SUFFIX@_FCFLAGS = $(test_program_fcflags)
......@@ -355,73 +345,73 @@ endif
endif
check_SCRIPTS += \
legacy_real_1stage@SUFFIX@.sh \
legacy_real_2stage@SUFFIX@.sh \
legacy_real_2stage_default@SUFFIX@.sh \
legacy_complex_1stage@SUFFIX@.sh \
legacy_complex_2stage@SUFFIX@.sh \
legacy_real_2stage_qr@SUFFIX@.sh \
legacy_complex_2stage_default@SUFFIX@.sh \
legacy_real_2stage_api@SUFFIX@.sh \
legacy_complex_2stage_api@SUFFIX@.sh \
legacy_real_driver@SUFFIX@.sh \
legacy_complex_driver@SUFFIX@.sh \
legacy_real_toeplitz@SUFFIX@.sh \
legacy_real_cholesky@SUFFIX@.sh \
legacy_real_invert_trm@SUFFIX@.sh \
legacy_real_transpose_multiply@SUFFIX@.sh \
legacy_complex_cholesky@SUFFIX@.sh \
legacy_complex_invert_trm@SUFFIX@.sh \
legacy_complex_transpose_multiply@SUFFIX@.sh \
legacy_real_1stage_c_version@SUFFIX@.sh \
legacy_complex_1stage_c_version@SUFFIX@.sh \
legacy_real_2stage_c_version@SUFFIX@.sh \
legacy_complex_2stage_c_version@SUFFIX@.sh \
legacy_real_driver_c_version@SUFFIX@.sh \
legacy_complex_driver_c_version@SUFFIX@.sh
legacy_real_1stage@SUFFIX@_default.sh \
legacy_real_2stage@SUFFIX@_default.sh \
legacy_real_2stage_default@SUFFIX@_default.sh \
legacy_complex_1stage@SUFFIX@_default.sh \
legacy_complex_2stage@SUFFIX@_default.sh \
legacy_real_2stage_qr@SUFFIX@_default.sh \
legacy_complex_2stage_default@SUFFIX@_default.sh \
legacy_real_2stage_api@SUFFIX@_default.sh \
legacy_complex_2stage_api@SUFFIX@_default.sh \
legacy_real_driver@SUFFIX@_default.sh \
legacy_complex_driver@SUFFIX@_default.sh \
legacy_real_toeplitz@SUFFIX@_default.sh \
legacy_real_cholesky@SUFFIX@_default.sh \
legacy_real_invert_trm@SUFFIX@_default.sh \
legacy_real_transpose_multiply@SUFFIX@_default.sh \
legacy_complex_cholesky@SUFFIX@_default.sh \
legacy_complex_invert_trm@SUFFIX@_default.sh \
legacy_complex_transpose_multiply@SUFFIX@_default.sh \
legacy_real_1stage_c_version@SUFFIX@_default.sh \
legacy_complex_1stage_c_version@SUFFIX@_default.sh \
legacy_real_2stage_c_version@SUFFIX@_default.sh \
legacy_complex_2stage_c_version@SUFFIX@_default.sh \
legacy_real_driver_c_version@SUFFIX@_default.sh \
legacy_complex_driver_c_version@SUFFIX@_default.sh
if WANT_SINGLE_PRECISION_REAL
check_SCRIPTS += \
legacy_single_real_1stage@SUFFIX@.sh \
legacy_single_real_2stage@SUFFIX@.sh \
legacy_single_real_2stage_default@SUFFIX@.sh \
legacy_single_real_2stage_qr@SUFFIX@.sh \
legacy_single_real_driver@SUFFIX@.sh \
legacy_single_real_cholesky@SUFFIX@.sh \
legacy_single_real_invert_trm@SUFFIX@.sh \
legacy_single_real_transpose_multiply@SUFFIX@.sh \
legacy_single_real_2stage_api@SUFFIX@.sh \
legacy_single_real_driver_c_version@SUFFIX@.sh
legacy_single_real_1stage@SUFFIX@_default.sh \
legacy_single_real_2stage@SUFFIX@_default.sh \
legacy_single_real_2stage_default@SUFFIX@_default.sh \
legacy_single_real_2stage_qr@SUFFIX@_default.sh \
legacy_single_real_driver@SUFFIX@_default.sh \
legacy_single_real_cholesky@SUFFIX@_default.sh \
legacy_single_real_invert_trm@SUFFIX@_default.sh \
legacy_single_real_transpose_multiply@SUFFIX@_default.sh \
legacy_single_real_2stage_api@SUFFIX@_default.sh \
legacy_single_real_driver_c_version@SUFFIX@_default.sh
endif
if WANT_SINGLE_PRECISION_COMPLEX
check_SCRIPTS += \
legacy_single_complex_1stage@SUFFIX@.sh \
legacy_single_complex_2stage@SUFFIX@.sh \
legacy_single_complex_2stage_default@SUFFIX@.sh \
legacy_single_complex_cholesky@SUFFIX@.sh \
legacy_single_complex_driver@SUFFIX@.sh \
legacy_single_complex_invert_trm@SUFFIX@.sh \
legacy_single_complex_transpose_multiply@SUFFIX@.sh \
legacy_single_complex_2stage_api@SUFFIX@.sh \
legacy_single_complex_driver_c_version@SUFFIX@.sh
legacy_single_complex_1stage@SUFFIX@_default.sh \
legacy_single_complex_2stage@SUFFIX@_default.sh \
legacy_single_complex_2stage_default@SUFFIX@_default.sh \
legacy_single_complex_cholesky@SUFFIX@_default.sh \
legacy_single_complex_driver@SUFFIX@_default.sh \
legacy_single_complex_invert_trm@SUFFIX@_default.sh \
legacy_single_complex_transpose_multiply@SUFFIX@_default.sh \
legacy_single_complex_2stage_api@SUFFIX@_default.sh \
legacy_single_complex_driver_c_version@SUFFIX@_default.sh
endif
if WITH_GPU_VERSION
check_SCRIPTS += \
legacy_real_1stage_gpu@SUFFIX@.sh \
legacy_complex_1stage_gpu@SUFFIX@.sh \
legacy_real_2stage_gpu@SUFFIX@.sh \
legacy_complex_2stage_gpu@SUFFIX@.sh
legacy_real_1stage_gpu@SUFFIX@_default.sh \
legacy_complex_1stage_gpu@SUFFIX@_default.sh \
legacy_real_2stage_gpu@SUFFIX@_default.sh \
legacy_complex_2stage_gpu@SUFFIX@_default.sh
if WANT_SINGLE_PRECISION_REAL
check_SCRIPTS += \
legacy_single_real_1stage_gpu@SUFFIX@.sh \
legacy_single_real_2stage_gpu@SUFFIX@.sh
legacy_single_real_1stage_gpu@SUFFIX@_default.sh \
legacy_single_real_2stage_gpu@SUFFIX@_default.sh
endif
if WANT_SINGLE_PRECISION_COMPLEX
check_SCRIPTS += \
legacy_single_complex_1stage_gpu@SUFFIX@.sh \
legacy_single_complex_2stage_gpu@SUFFIX@.sh
legacy_single_complex_1stage_gpu@SUFFIX@_default.sh \
legacy_single_complex_2stage_gpu@SUFFIX@_default.sh
endif
endif
/* This file is part of ELPA. */
/* */
/* The ELPA library was originally created by the ELPA consortium, */
/* consisting of the following organizations: */
/* */
/* - Max Planck Computing and Data Facility (MPCDF), formerly known as */
/* Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG), */
/* - Bergische Universität Wuppertal, Lehrstuhl für angewandte */
/* Informatik, */
/* - Technische Universität München, Lehrstuhl für Informatik mit */
/* Schwerpunkt Wissenschaftliches Rechnen , */
/* - Fritz-Haber-Institut, Berlin, Abt. Theorie, */
/* - Max-Plack-Institut für Mathematik in den Naturwissenschaften, */
/* Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition, */
/* and */
/* - IBM Deutschland GmbH */
/* */
/* */
/* More information can be found here: */
/* http://elpa.mpcdf.mpg.de/ */
/* */
/* ELPA is free software: you can redistribute it and/or modify */
/* it under the terms of the version 3 of the license of the */
/* GNU Lesser General Public License as published by the Free */
/* Software Foundation. */
/* */
/* ELPA is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with ELPA. If not, see <http://www.gnu.org/licenses/> */
/* */
/* ELPA reflects a substantial effort on the part of the original */
/* ELPA consortium, and we ask you to respect the spirit of the */
/* license that we chose: i.e., please contribute any changes you */
/* may have back to the original ELPA library distribution, and keep */
/* any derivatives of ELPA under the same license that we chose for */
/* the original distribution, the GNU Lesser General Public License. */
/* */
/* */
#include "config-f90.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef WITH_MPI
#include <mpi.h>
#endif
#include <math.h>
#include <elpa/elpa.h>
#include <assert.h>
#include <test/shared/generated.h>
#define DOUBLE_PRECISION_REAL 1
#define assert_elpa_ok(x) assert(x == ELPA_OK)
int main(int argc, char** argv) {
int myid;
int nprocs;
#ifndef WITH_MPI
int MPI_COMM_WORLD;
#endif
int na, nev, nblk;
int status;
int np_cols, np_rows, np_colsStart;
int my_blacs_ctxt, my_prow, my_pcol;
int mpierr;
int my_mpi_comm_world;
int mpi_comm_rows, mpi_comm_cols;
int info, *sc_desc;
int na_rows, na_cols;
double startVal;
#ifdef DOUBLE_PRECISION_REAL
double *a, *z, *as, *ev;
#else
float *a, *z, *as, *ev;
#endif
int success;
elpa_t handle;
int value, error;
#ifdef WITH_MPI
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
#else
nprocs = 1;
myid=0;
MPI_COMM_WORLD=1;
#endif
na = 1000;
nev = 500;
nblk = 16;
if (myid == 0) {
printf("This is the c version of an ELPA test-programm\n");
printf("\n");
printf("It will call the 2stage ELPA real solver for an\n");
printf("matrix of size %d. It will compute %d eigenvalues\n",na,nev);
printf("and uses a blocksize of %d\n",nblk);
printf("\n");
printf("This is an example program with much less functionality\n");
printf("as it's Fortran counterpart. It's only purpose is to show how \n");
printf("to evoke ELPA2 from a c programm\n");
printf("\n");
#ifdef DOUBLE_PRECISION_REAL
printf(" Double precision version of ELPA2 is used. \n");
#else
printf(" Single precision version of ELPA2 is used. \n");
#endif
}
status = 0;
startVal = sqrt((double) nprocs);
np_colsStart = (int) round(startVal);
for (np_cols=np_colsStart;np_cols>1;np_cols--){
if (nprocs %np_cols ==0){
break;
}
}
np_rows = nprocs/np_cols;
if (myid == 0) {
printf("\n");
printf("Number of processor rows %d, cols %d, total %d \n",np_rows,np_cols,nprocs);
}
/* set up blacs */
/* convert communicators before */
#ifdef WITH_MPI
my_mpi_comm_world = MPI_Comm_c2f(MPI_COMM_WORLD);
#else
my_mpi_comm_world = 1;
#endif
set_up_blacsgrid_f(my_mpi_comm_world, np_rows, np_cols, 'C', &my_blacs_ctxt, &my_prow, &my_pcol);
if (myid == 0) {
printf("\n");
printf("Past BLACS_Gridinfo...\n");
printf("\n");
}
sc_desc = malloc(9*sizeof(int));
set_up_blacs_descriptor_f(na, nblk, my_prow, my_pcol, np_rows, np_cols, &na_rows, &na_cols, sc_desc, my_blacs_ctxt, &info);
if (myid == 0) {
printf("\n");
printf("Past scalapack descriptor setup...\n");
printf("\n");
}
/* allocate the matrices needed for elpa */
if (myid == 0) {
printf("\n");
printf("Allocating matrices with na_rows=%d and na_cols=%d\n",na_rows, na_cols);
printf("\n");
}
#ifdef DOUBLE_PRECISION_REAL
a = malloc(na_rows*na_cols*sizeof(double));
z = malloc(na_rows*na_cols*sizeof(double));
as = malloc(na_rows*na_cols*sizeof(double));
ev = malloc(na*sizeof(double));
#else
a = malloc(na_rows*na_cols*sizeof(float));
z = malloc(na_rows*na_cols*sizeof(float));
as = malloc(na_rows*na_cols*sizeof(float));
ev = malloc(na*sizeof(float));
#endif
#ifdef DOUBLE_PRECISION_REAL
prepare_matrix_random_real_double_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
#else
prepare_matrix_random_real_single_f(na, myid, na_rows, na_cols, sc_desc, a, z, as);
#endif
if (elpa_init(CURRENT_API_VERSION) != ELPA_OK) {
fprintf(stderr, "Error: ELPA API version not supported");
exit(1);
}
handle = elpa_allocate(&error);
assert_elpa_ok(error);
/* Set parameters */
elpa_set(handle, "na", na, &error);
assert_elpa_ok(error);
elpa_set(handle, "nev", nev, &error);
assert_elpa_ok(error);
elpa_set(handle, "local_nrows", na_rows, &error);
assert_elpa_ok(error);
elpa_set(handle, "local_ncols", na_cols, &error);
assert_elpa_ok(error);
elpa_set(handle, "nblk", nblk, &error);
assert_elpa_ok(error);
#ifdef WITH_MPI
elpa_set(handle, "mpi_comm_parent", MPI_Comm_c2f(MPI_COMM_WORLD), &error);
assert_elpa_ok(error);
elpa_set(handle, "process_row", my_prow, &error);
assert_elpa_ok(error);
elpa_set(handle, "process_col", my_pcol, &error);
assert_elpa_ok(error);
#endif
/* Setup */
assert_elpa_ok(elpa_setup(handle));
/* Set tunables */
elpa_set(handle, "solver", ELPA_SOLVER_2STAGE, &error);
assert_elpa_ok(error);
elpa_set(handle, "gpu", 0, &error);
assert_elpa_ok(error);
elpa_set(handle, "real_kernel", ELPA_2STAGE_REAL_GENERIC, &error);
assert_elpa_ok(error);
elpa_get(handle, "solver", &value, &error);
if (myid == 0) {
printf("Solver is set to %d \n", value);
}
if (myid == 0) {
printf("\n");
printf("Entering ELPA 2stage real solver\n");
printf("\n");
}
#ifdef WITH_MPI
mpierr = MPI_Barrier(MPI_COMM_WORLD);
#endif
/* Solve EV problem */
elpa_eigenvectors(handle, a, ev, z, &error);
assert_elpa_ok(error);
elpa_deallocate(handle);
elpa_uninit();
if (myid == 0) {
printf("\n");
printf("2stage ELPA real solver complete\n");
printf("\n");
}
/* check the results */
#ifdef DOUBLE_PRECISION_REAL
status = check_correctness_evp_numeric_residuals_real_double_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
#else
status = check_correctness_evp_numeric_residuals_real_single_f(na, nev, na_rows, na_cols, as, z, ev, sc_desc, myid);
#endif
if (status !=0){
printf("The computed EVs are not correct !\n");
}
if (status ==0){
if (myid ==0) {
printf("All ok!\n");
}
}
free(sc_desc);
free(a);
free(z);
free(as);
free(ev);
#ifdef WITH_MPI
MPI_Finalize();
#endif
return 0;
}
......@@ -55,15 +55,15 @@
#include "test/shared/generated.h"
#if !(defined(TEST_REAL) ^ defined(TEST_COMPLEX))
//#error "define exactly one of TEST_REAL or TEST_COMPLEX"
#error "define exactly one of TEST_REAL or TEST_COMPLEX"
#endif
#if !(defined(TEST_SINGLE) ^ defined(TEST_DOUBLE))
//#error "define exactly one of TEST_SINGLE or TEST_DOUBLE"
#error "define exactly one of TEST_SINGLE or TEST_DOUBLE"
#endif
#if !(defined(TEST_SOLVER_1STAGE) ^ defined(TEST_SOLVER_2STAGE))
//#error "define exactly one of TEST_SOLVER_1STAGE or TEST_SOLVER_2STAGE"
#error "define exactly one of TEST_SOLVER_1STAGE or TEST_SOLVER_2STAGE"
#endif
#ifdef TEST_SINGLE
......@@ -71,7 +71,7 @@
# ifdef TEST_REAL
# define MATRIX_TYPE float
# else
# define MATRIX_TYPE complex
# define MATRIX_TYPE complex float
# endif
#else
# define EV_TYPE double
......@@ -130,9 +130,15 @@ int main(int argc, char** argv) {
myid = 0;
#endif
na = 1000;
nev = 500;
nblk = 16;
if (argc == 4) {
na = atoi(argv[1]);
nev = atoi(argv[2]);
nblk = atoi(argv[3]);
} else {
na = 1000;
nev = 500;
nblk = 16;
}
for (np_cols = (int) sqrt((double) nprocs); np_cols > 1; np_cols--) {
if (nprocs % np_cols == 0) {
......
......@@ -453,6 +453,13 @@ function check_correctness_evp_numeric_residuals_&
print *,"Eigenvalues differ from analytic solution: maxerr = ",maxerr
endif
endif
if (status .eq. 0) then
if (myid .eq. 0) then
print *,"Result of Toeplitz matrix test: test passed"
print *,"Eigenvalues differ from analytic solution: maxerr = ",maxerr
endif
endif
end function
function check_correctness_cholesky_&
......
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