From eaa3e6aaf6aff695eb8bc60e384133864092a0d0 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Wed, 3 Jun 2015 13:07:00 +0100 Subject: [PATCH] Assist for generating file lists contained in Make.inc files for convenience when things are added --- benchmarks/Make.inc | 23 +++ benchmarks/Makefile.am | 23 +-- ...nchmark_su3_expr.cc => simple_su3_expr.cc} | 0 ...nchmark_su3_test.cc => simple_su3_test.cc} | 0 lib/Make.inc | 1 + scripts/filelist | 49 +++++- tests/Make.inc | 83 +++++++++ tests/Makefile.am | 89 +--------- tests/Test_simd_new.cc | 165 ------------------ 9 files changed, 157 insertions(+), 276 deletions(-) create mode 100644 benchmarks/Make.inc rename benchmarks/{Benchmark_su3_expr.cc => simple_su3_expr.cc} (100%) rename benchmarks/{Benchmark_su3_test.cc => simple_su3_test.cc} (100%) create mode 100644 tests/Make.inc delete mode 100644 tests/Test_simd_new.cc diff --git a/benchmarks/Make.inc b/benchmarks/Make.inc new file mode 100644 index 00000000..9871149c --- /dev/null +++ b/benchmarks/Make.inc @@ -0,0 +1,23 @@ + +bin_PROGRAMS = Benchmark_comms Benchmark_dwf Benchmark_memory_bandwidth Benchmark_su3 Benchmark_wilson + + +Benchmark_comms_SOURCES=Benchmark_comms.cc +Benchmark_comms_LDADD=-lGrid + + +Benchmark_dwf_SOURCES=Benchmark_dwf.cc +Benchmark_dwf_LDADD=-lGrid + + +Benchmark_memory_bandwidth_SOURCES=Benchmark_memory_bandwidth.cc +Benchmark_memory_bandwidth_LDADD=-lGrid + + +Benchmark_su3_SOURCES=Benchmark_su3.cc +Benchmark_su3_LDADD=-lGrid + + +Benchmark_wilson_SOURCES=Benchmark_wilson.cc +Benchmark_wilson_LDADD=-lGrid + diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am index 74ff03c6..8081844f 100644 --- a/benchmarks/Makefile.am +++ b/benchmarks/Makefile.am @@ -5,25 +5,4 @@ AM_LDFLAGS = -L$(top_builddir)/lib # # Test code # -bin_PROGRAMS = \ - Benchmark_comms \ - Benchmark_memory_bandwidth \ - Benchmark_su3 \ - Benchmark_wilson \ - Benchmark_dwf - -Benchmark_comms_SOURCES = Benchmark_comms.cc -Benchmark_comms_LDADD = -lGrid - -Benchmark_memory_bandwidth_SOURCES = Benchmark_memory_bandwidth.cc -Benchmark_memory_bandwidth_LDADD = -lGrid - -Benchmark_su3_SOURCES = Benchmark_su3.cc Benchmark_su3_test.cc Benchmark_su3_expr.cc -Benchmark_su3_LDADD = -lGrid - -Benchmark_wilson_SOURCES = Benchmark_wilson.cc -Benchmark_wilson_LDADD = -lGrid - -Benchmark_dwf_SOURCES = Benchmark_dwf.cc -Benchmark_dwf_LDADD = -lGrid - +include Make.inc diff --git a/benchmarks/Benchmark_su3_expr.cc b/benchmarks/simple_su3_expr.cc similarity index 100% rename from benchmarks/Benchmark_su3_expr.cc rename to benchmarks/simple_su3_expr.cc diff --git a/benchmarks/Benchmark_su3_test.cc b/benchmarks/simple_su3_test.cc similarity index 100% rename from benchmarks/Benchmark_su3_test.cc rename to benchmarks/simple_su3_test.cc diff --git a/lib/Make.inc b/lib/Make.inc index 31683256..dd5269ac 100644 --- a/lib/Make.inc +++ b/lib/Make.inc @@ -1,3 +1,4 @@ + HFILES=./algorithms/approx/bigfloat.h ./algorithms/approx/bigfloat_double.h ./algorithms/approx/Chebyshev.h ./algorithms/approx/Remez.h ./algorithms/approx/Zolotarev.h ./algorithms/iterative/ConjugateGradient.h ./algorithms/iterative/NormalEquations.h ./algorithms/iterative/SchurRedBlack.h ./algorithms/LinearOperator.h ./algorithms/SparseMatrix.h ./Algorithms.h ./AlignedAllocator.h ./cartesian/Cartesian_base.h ./cartesian/Cartesian_full.h ./cartesian/Cartesian_red_black.h ./Cartesian.h ./communicator/Communicator_base.h ./Communicator.h ./Comparison.h ./cshift/Cshift_common.h ./cshift/Cshift_mpi.h ./cshift/Cshift_none.h ./Cshift.h ./Grid.h ./GridConfig.h ./lattice/Lattice_arith.h ./lattice/Lattice_base.h ./lattice/Lattice_comparison.h ./lattice/Lattice_conformable.h ./lattice/Lattice_coordinate.h ./lattice/Lattice_ET.h ./lattice/Lattice_local.h ./lattice/Lattice_overload.h ./lattice/Lattice_peekpoke.h ./lattice/Lattice_reality.h ./lattice/Lattice_reduction.h ./lattice/Lattice_rng.h ./lattice/Lattice_trace.h ./lattice/Lattice_transfer.h ./lattice/Lattice_transpose.h ./lattice/Lattice_where.h ./Lattice.h ./parallelIO/NerscIO.h ./qcd/action/Actions.h ./qcd/action/DiffAction.h ./qcd/action/fermion/CayleyFermion5D.h ./qcd/action/fermion/ContinuedFractionFermion5D.h ./qcd/action/fermion/DomainWallFermion.h ./qcd/action/fermion/FermionOperator.h ./qcd/action/fermion/MobiusFermion.h ./qcd/action/fermion/MobiusZolotarevFermion.h ./qcd/action/fermion/OverlapWilsonCayleyTanhFermion.h ./qcd/action/fermion/OverlapWilsonCayleyZolotarevFermion.h ./qcd/action/fermion/PartialFractionFermion5D.h ./qcd/action/fermion/ScaledShamirFermion.h ./qcd/action/fermion/ShamirZolotarevFermion.h ./qcd/action/fermion/WilsonCompressor.h ./qcd/action/fermion/WilsonFermion.h ./qcd/action/fermion/WilsonFermion5D.h ./qcd/action/fermion/WilsonKernels.h ./qcd/Dirac.h ./qcd/LinalgUtils.h ./qcd/QCD.h ./qcd/SpaceTimeGrid.h ./qcd/TwoSpinor.h ./simd/Grid_avx.h ./simd/Grid_avx512.h ./simd/Grid_qpx.h ./simd/Grid_sse4.h ./simd/Grid_vector_types.h ./simd/Old/Grid_vComplexD.h ./simd/Old/Grid_vComplexF.h ./simd/Old/Grid_vInteger.h ./simd/Old/Grid_vRealD.h ./simd/Old/Grid_vRealF.h ./Simd.h ./stencil/Lebesgue.h ./Stencil.h ./tensors/Tensor_arith.h ./tensors/Tensor_arith_add.h ./tensors/Tensor_arith_mac.h ./tensors/Tensor_arith_mul.h ./tensors/Tensor_arith_scalar.h ./tensors/Tensor_arith_sub.h ./tensors/Tensor_class.h ./tensors/Tensor_extract_merge.h ./tensors/Tensor_inner.h ./tensors/Tensor_outer.h ./tensors/Tensor_peek.h ./tensors/Tensor_poke.h ./tensors/Tensor_reality.h ./tensors/Tensor_trace.h ./tensors/Tensor_traits.h ./tensors/Tensor_transpose.h ./Tensors.h ./Threads.h CCFILES=./algorithms/approx/Remez.cc ./algorithms/approx/Zolotarev.cc ./GridInit.cc ./qcd/action/fermion/CayleyFermion5D.cc ./qcd/action/fermion/ContinuedFractionFermion5D.cc ./qcd/action/fermion/PartialFractionFermion5D.cc ./qcd/action/fermion/WilsonFermion.cc ./qcd/action/fermion/WilsonFermion5D.cc ./qcd/action/fermion/WilsonKernels.cc ./qcd/action/fermion/WilsonKernelsHand.cc ./qcd/Dirac.cc ./qcd/SpaceTimeGrid.cc ./stencil/Lebesgue.cc ./stencil/Stencil_common.cc diff --git a/scripts/filelist b/scripts/filelist index 73c6db51..1b575611 100755 --- a/scripts/filelist +++ b/scripts/filelist @@ -1,9 +1,56 @@ #!/bin/bash cd lib + HFILES=`find . -type f -name '*.h'` CCFILES=`find . -type f -name '*.cc' -not -name '*ommunicator*.cc'` -echo HFILES=$HFILES > Make.inc +echo> Make.inc +echo HFILES=$HFILES >> Make.inc echo >> Make.inc echo CCFILES=$CCFILES >> Make.inc + cd .. + + + +cd tests + +echo> Make.inc +TESTS=`ls T*.cc` +TESTLIST=`echo ${TESTS} | sed s/.cc//g ` + +echo > Make.inc +echo bin_PROGRAMS = ${TESTLIST} >> Make.inc +echo >> Make.inc + +for f in $TESTS +do +BNAME=`basename $f .cc` +echo >> Make.inc +echo ${BNAME}_SOURCES=$f >> Make.inc +echo ${BNAME}_LDADD=-lGrid>> Make.inc +echo >> Make.inc +done + +cd .. + + +cd benchmarks + + +echo> Make.inc +TESTS=`ls B*.cc` +TESTLIST=`echo ${TESTS} | sed s/.cc//g ` + +echo > Make.inc +echo bin_PROGRAMS = ${TESTLIST} >> Make.inc +echo >> Make.inc + +for f in $TESTS +do +BNAME=`basename $f .cc` +echo >> Make.inc +echo ${BNAME}_SOURCES=$f >> Make.inc +echo ${BNAME}_LDADD=-lGrid>> Make.inc +echo >> Make.inc +done diff --git a/tests/Make.inc b/tests/Make.inc new file mode 100644 index 00000000..d592f218 --- /dev/null +++ b/tests/Make.inc @@ -0,0 +1,83 @@ + +bin_PROGRAMS = Test_cshift Test_cshift_red_black Test_dwf_cg_prec Test_dwf_cg_schur Test_dwf_cg_unprec Test_dwf_even_odd Test_gamma Test_main Test_many_cg Test_many_evenodd Test_nersc_io Test_remez Test_rng Test_rng_fixed Test_simd Test_stencil Test_wilson_cg_prec Test_wilson_cg_schur Test_wilson_cg_unprec Test_wilson_evenodd + + +Test_cshift_SOURCES=Test_cshift.cc +Test_cshift_LDADD=-lGrid + + +Test_cshift_red_black_SOURCES=Test_cshift_red_black.cc +Test_cshift_red_black_LDADD=-lGrid + + +Test_dwf_cg_prec_SOURCES=Test_dwf_cg_prec.cc +Test_dwf_cg_prec_LDADD=-lGrid + + +Test_dwf_cg_schur_SOURCES=Test_dwf_cg_schur.cc +Test_dwf_cg_schur_LDADD=-lGrid + + +Test_dwf_cg_unprec_SOURCES=Test_dwf_cg_unprec.cc +Test_dwf_cg_unprec_LDADD=-lGrid + + +Test_dwf_even_odd_SOURCES=Test_dwf_even_odd.cc +Test_dwf_even_odd_LDADD=-lGrid + + +Test_gamma_SOURCES=Test_gamma.cc +Test_gamma_LDADD=-lGrid + + +Test_main_SOURCES=Test_main.cc +Test_main_LDADD=-lGrid + + +Test_many_cg_SOURCES=Test_many_cg.cc +Test_many_cg_LDADD=-lGrid + + +Test_many_evenodd_SOURCES=Test_many_evenodd.cc +Test_many_evenodd_LDADD=-lGrid + + +Test_nersc_io_SOURCES=Test_nersc_io.cc +Test_nersc_io_LDADD=-lGrid + + +Test_remez_SOURCES=Test_remez.cc +Test_remez_LDADD=-lGrid + + +Test_rng_SOURCES=Test_rng.cc +Test_rng_LDADD=-lGrid + + +Test_rng_fixed_SOURCES=Test_rng_fixed.cc +Test_rng_fixed_LDADD=-lGrid + + +Test_simd_SOURCES=Test_simd.cc +Test_simd_LDADD=-lGrid + + +Test_stencil_SOURCES=Test_stencil.cc +Test_stencil_LDADD=-lGrid + + +Test_wilson_cg_prec_SOURCES=Test_wilson_cg_prec.cc +Test_wilson_cg_prec_LDADD=-lGrid + + +Test_wilson_cg_schur_SOURCES=Test_wilson_cg_schur.cc +Test_wilson_cg_schur_LDADD=-lGrid + + +Test_wilson_cg_unprec_SOURCES=Test_wilson_cg_unprec.cc +Test_wilson_cg_unprec_LDADD=-lGrid + + +Test_wilson_evenodd_SOURCES=Test_wilson_evenodd.cc +Test_wilson_evenodd_LDADD=-lGrid + diff --git a/tests/Makefile.am b/tests/Makefile.am index bb3448f1..83385001 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,91 +2,4 @@ AM_CXXFLAGS = -I$(top_srcdir)/lib AM_LDFLAGS = -L$(top_builddir)/lib -# -# Test code -# -bin_PROGRAMS = Test_main \ - Test_simd \ - Test_gamma \ - Test_cshift \ - Test_cshift_red_black \ - Test_stencil \ - Test_nersc_io \ - Test_rng \ - Test_remez \ - Test_rng_fixed \ - Test_wilson_evenodd \ - Test_wilson_cg_unprec \ - Test_wilson_cg_prec \ - Test_wilson_cg_schur \ - Test_dwf_even_odd\ - Test_dwf_cg_unprec\ - Test_dwf_cg_prec\ - Test_dwf_cg_schur\ - Test_many_evenodd\ - Test_many_cg - - - -Test_main_SOURCES = Test_main.cc -Test_main_LDADD = -lGrid - -Test_rng_SOURCES = Test_rng.cc -Test_rng_LDADD = -lGrid - -Test_rng_fixed_SOURCES = Test_rng_fixed.cc -Test_rng_fixed_LDADD = -lGrid - -Test_remez_SOURCES = Test_remez.cc -Test_remez_LDADD = -lGrid - -Test_nersc_io_SOURCES = Test_nersc_io.cc -Test_nersc_io_LDADD = -lGrid - -Test_cshift_SOURCES = Test_cshift.cc -Test_cshift_LDADD = -lGrid - -Test_cshift_red_black_SOURCES = Test_cshift_red_black.cc -Test_cshift_red_black_LDADD = -lGrid - -Test_gamma_SOURCES = Test_gamma.cc -Test_gamma_LDADD = -lGrid - -Test_stencil_SOURCES = Test_stencil.cc -Test_stencil_LDADD = -lGrid - -Test_simd_SOURCES = Test_simd.cc -Test_simd_LDADD = -lGrid - -#Test_simd_new_SOURCES = Test_simd_new.cc -#Test_simd_new_LDADD = -lGrid - -Test_wilson_evenodd_SOURCES = Test_wilson_evenodd.cc -Test_wilson_evenodd_LDADD = -lGrid - -Test_wilson_cg_unprec_SOURCES = Test_wilson_cg_unprec.cc -Test_wilson_cg_unprec_LDADD = -lGrid - -Test_wilson_cg_prec_SOURCES = Test_wilson_cg_prec.cc -Test_wilson_cg_prec_LDADD = -lGrid - -Test_wilson_cg_schur_SOURCES = Test_wilson_cg_schur.cc -Test_wilson_cg_schur_LDADD = -lGrid - -Test_dwf_even_odd_SOURCES = Test_dwf_even_odd.cc -Test_dwf_even_odd_LDADD = -lGrid - -Test_dwf_cg_unprec_SOURCES = Test_dwf_cg_unprec.cc -Test_dwf_cg_unprec_LDADD = -lGrid - -Test_dwf_cg_prec_SOURCES = Test_dwf_cg_prec.cc -Test_dwf_cg_prec_LDADD = -lGrid - -Test_dwf_cg_schur_SOURCES = Test_dwf_cg_schur.cc -Test_dwf_cg_schur_LDADD = -lGrid - -Test_many_evenodd_SOURCES = Test_many_evenodd.cc -Test_many_evenodd_LDADD = -lGrid - -Test_many_cg_SOURCES = Test_many_cg.cc -Test_many_cg_LDADD = -lGrid +include Make.inc diff --git a/tests/Test_simd_new.cc b/tests/Test_simd_new.cc deleted file mode 100644 index 41781304..00000000 --- a/tests/Test_simd_new.cc +++ /dev/null @@ -1,165 +0,0 @@ -#include -#include "simd/Grid_vector_types.h" -#include - -using namespace std; -using namespace Grid; -using namespace Grid::QCD; - -class funcPlus { -public: - funcPlus() {}; - template void operator()(vec &rr,vec &i1,vec &i2) const { rr = i1+i2;} - std::string name(void) const { return std::string("Plus"); } -}; -class funcMinus { -public: - funcMinus() {}; - template void operator()(vec &rr,vec &i1,vec &i2) const { rr = i1-i2;} - std::string name(void) const { return std::string("Minus"); } -}; -class funcTimes { -public: - funcTimes() {}; - template void operator()(vec &rr,vec &i1,vec &i2) const { rr = i1*i2;} - std::string name(void) const { return std::string("Times"); } -}; -class funcConj { -public: - funcConj() {}; - template void operator()(vec &rr,vec &i1,vec &i2) const { rr = conjugate(i1);} - std::string name(void) const { return std::string("Conj"); } -}; -class funcAdj { -public: - funcAdj() {}; - template void operator()(vec &rr,vec &i1,vec &i2) const { rr = adj(i1);} - std::string name(void) const { return std::string("Adj"); } -}; - -class funcTimesI { -public: - funcTimesI() {}; - template void operator()(vec &rr,vec &i1,vec &i2) const { rr = timesI(i1);} - std::string name(void) const { return std::string("timesI"); } -}; - -class funcTimesMinusI { -public: - funcTimesMinusI() {}; - template void operator()(vec &rr,vec &i1,vec &i2) const { rr = timesMinusI(i1);} - std::string name(void) const { return std::string("timesMinusI"); } -}; - -template -void Tester(const functor &func) -{ - GridSerialRNG sRNG; - sRNG.SeedRandomDevice(); - - int Nsimd = vec::Nsimd(); - - std::vector input1(Nsimd); - std::vector input2(Nsimd); - std::vector result(Nsimd); - std::vector reference(Nsimd); - - std::vector > buf(3); - vec & v_input1 = buf[0]; - vec & v_input2 = buf[1]; - vec & v_result = buf[2]; - - - for(int i=0;i(v_input1,input1); - merge(v_input2,input2); - merge(v_result,result); - - func(v_result,v_input1,v_input2); - - for(int i=0;i(v_result,result); - std::cout << " " << func.name()<0){ - std::cout<< "*****" << std::endl; - std::cout<< "["< latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(4,MyComplexF::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); - - GridCartesian Grid(latt_size,simd_layout,mpi_layout); - std::vector seeds({1,2,3,4}); - - // Insist that operations on random scalars gives - // identical results to on vectors. - - std::cout << "==================================="<< std::endl; - std::cout << "Testing MyComplexF "<(funcTimesI()); - Tester(funcTimesMinusI()); - Tester(funcPlus()); - Tester(funcMinus()); - Tester(funcTimes()); - Tester(funcConj()); - Tester(funcAdj()); - - std::cout << "==================================="<< std::endl; - std::cout << "Testing MyComplexD "<(funcTimesI()); - Tester(funcTimesMinusI()); - Tester(funcPlus()); - Tester(funcMinus()); - Tester(funcTimes()); - Tester(funcConj()); - Tester(funcAdj()); - - std::cout << "==================================="<< std::endl; - std::cout << "Testing MyRealF "<(funcPlus()); - Tester(funcMinus()); - Tester(funcTimes()); - Tester(funcAdj()); - - std::cout << "==================================="<< std::endl; - std::cout << "Testing MyRealD "<(funcPlus()); - Tester(funcMinus()); - Tester(funcTimes()); - Tester(funcAdj()); - - Grid_finalize(); -}