Commit 6b35584c authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Merge branch 'wrap_output' into 'master'

Wrap output

See merge request giacomo.mulas/np_tmcode!75
parents 6e1610f7 62cd0416
Loading
Loading
Loading
Loading
+34 −9
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ building_stage:
      - cat /etc/os-release
      - cd build
      - echo "Configuring with default compilers (MAGMA disabled)..."
      - ./configure --without-magma --without-cublas --disable-offload --enable-refinement
      - ./configure --without-magma --without-cublas --disable-offload --enable-refinement --enable-shared
      - make wipe
      - echo "Building the default configuration..."
      - make -j
@@ -185,11 +185,19 @@ sanity_stage:
      - hostname
      - echo $CI_COMMIT_SHA
      - echo $CI_COMMIT_BRANCH
      - cd build/testing
      - echo "Running memory sanity check"
      - cd build/libnptm
      - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH;$PWD"
      - cd ../testing
      - echo "Running memory sanity check for ParticleDescriptor"
      - chmod +x test_ParticleDescriptor
      - valgrind --leak-check=full --log-file=valgrind.log ./test_ParticleDescriptor
      - grep "no leaks are possible" valgrind.log
      - grep "0 errors from 0 contexts" valgrind.log
      - echo "Running memory sanity check for output classes"
      - chmod +x test_outputs
      - rm valgrind.log
      - valgrind --leak-check=full --log-file=valgrind.log ./test_outputs
      - grep "0 errors from 0 contexts" valgrind.log
      - rm -rf c_OCLU_24
      
running_stage:
   stage: run
@@ -215,7 +223,9 @@ running_stage:
      - hostname
      - echo $CI_COMMIT_SHA
      - echo $CI_COMMIT_BRANCH
      - cd build/sphere
      - cd build/libnptm
      - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH;$PWD"
      - cd ../sphere
      - echo "Running np_sphere"
      - chmod +x np_sphere
      - ./np_sphere
@@ -240,7 +250,7 @@ testing_stage:
      - running_stage
   artifacts:
      paths:
         - build/cluster/pycompare.html
         - build/cluster/pycompare_*.html
         - build/inclusion/pycompare.html
         - build/sphere/pycompare.html
      exclude:
@@ -253,7 +263,9 @@ testing_stage:
      - hostname
      - echo $CI_COMMIT_SHA
      - echo $CI_COMMIT_BRANCH
      - cd build/sphere
      - cd build/libnptm
      - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH;$PWD"
      - cd ../sphere
      - export FFILE=../../test_data/sphere/OSPH
      - echo "Comparing output of SPHERE"
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OSPH --html
@@ -266,13 +278,26 @@ testing_stage:
      - cd ../cluster
      - echo "Comparing output of CLUSTER"
      - export FFILE=../../test_data/cluster/OCLU
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OCLU --html
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OCLU --html=pycompare_dev.html
      - echo "Testing cluster with 24 spheres"
      - OMP_NUM_THREADS=1 OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 mpirun -n 2 ./np_cluster ../../test_data/cluster/DEDFB_24 ../../test_data/cluster/DCLU_24 .
      - echo "Comparing output of CLUSTER with 24 spheres"
      - export FFILE=../../test_data/cluster/OCLU_24
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OCLU --html
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OCLU --html=pycompare_24.html
      - echo "Checking consistency among legacy and HDF5 configuration files"
      - ../testing/test_TEDF ../../test_data/cluster/DEDFB_24 c_TEDF c_TEDF.hd5
      - echo "Checking consistency among legacy and HDF5 TM files"
      - ../testing/test_TTMS c_TTMS c_TTMS.hd5
      - echo "Testing cluster with 48 spheres"
      - OMP_NUM_THREADS=5 ./np_cluster ../../test_data/cluster/DEDFB_48 ../../test_data/cluster/DCLU_48 .
      - echo "Comparing output of CLUSTER with 48 spheres"
      - export FFILE=../../test_data/cluster/OCLU_48
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OCLU --html=pycompare_48.html
      - cd ../testing
      - echo "Checking consistency of HDF5 output"
      - chmod u+x test_outputs
      - ./test_outputs
      - export FFILE=../../test_data/cluster/OCLU_24
      - python3 ../../src/scripts/pycompare.py --no-progress --ffile $FFILE --cfile c_OCLU_24
      - rm -rf c_OCLU_24
      
 No newline at end of file
+16 −4
Original line number Diff line number Diff line
@@ -14,21 +14,29 @@ else
	NPTM_LIB=libnptm/libnptm.a
	CXXFLAGSLIB=-static
endif # LIBMODE
NP_LIBNPTM_SRCS=../src/libnptm/algebraic.cpp ../src/libnptm/clu_subs.cpp ../src/libnptm/Commons.cpp ../src/libnptm/Configuration.cpp ../src/libnptm/cublas_calls.cpp ../src/libnptm/file_io.cpp ../src/libnptm/inclu_subs.cpp ../src/libnptm/logging.cpp ../src/libnptm/lapack_calls.cpp ../src/libnptm/magma_calls.cpp ../src/libnptm/Parsers.cpp ../src/libnptm/sph_subs.cpp ../src/libnptm/tfrfme.cpp ../src/libnptm/tra_subs.cpp ../src/libnptm/TransitionMatrix.cpp ../src/libnptm/utils.cpp
NP_LIBNPTM_OBJS=../src/libnptm/algebraic.o ../src/libnptm/clu_subs.o ../src/libnptm/Commons.o ../src/libnptm/Configuration.o ../src/libnptm/cublas_calls.o ../src/libnptm/file_io.o ../src/libnptm/inclu_subs.o ../src/libnptm/logging.o ../src/libnptm/lapack_calls.o ../src/libnptm/magma_calls.o ../src/libnptm/Parsers.o ../src/libnptm/sph_subs.o ../src/libnptm/tfrfme.o ../src/libnptm/tra_subs.o ../src/libnptm/TransitionMatrix.o ../src/libnptm/utils.o
NP_DOC_SRCS=../doc/src/config.dox
NP_LIBNPTM_SRCS=../src/libnptm/algebraic.cpp ../src/libnptm/clu_subs.cpp ../src/libnptm/Commons.cpp ../src/libnptm/Configuration.cpp ../src/libnptm/cublas_calls.cpp ../src/libnptm/file_io.cpp ../src/libnptm/inclu_subs.cpp ../src/libnptm/logging.cpp ../src/libnptm/lapack_calls.cpp ../src/libnptm/magma_calls.cpp ../src/libnptm/outputs.cpp ../src/libnptm/Parsers.cpp ../src/libnptm/sph_subs.cpp ../src/libnptm/tfrfme.cpp ../src/libnptm/tra_subs.cpp ../src/libnptm/TransitionMatrix.cpp ../src/libnptm/utils.cpp
NP_LIBNPTM_OBJS=../src/libnptm/algebraic.o ../src/libnptm/clu_subs.o ../src/libnptm/Commons.o ../src/libnptm/Configuration.o ../src/libnptm/cublas_calls.o ../src/libnptm/file_io.o ../src/libnptm/inclu_subs.o ../src/libnptm/logging.o ../src/libnptm/lapack_calls.o ../src/libnptm/magma_calls.o ../src/libnptm/outputs.o ../src/libnptm/Parsers.o ../src/libnptm/sph_subs.o ../src/libnptm/tfrfme.o ../src/libnptm/tra_subs.o ../src/libnptm/TransitionMatrix.o ../src/libnptm/utils.o
NP_CLUSTER_SRCS=../src/cluster/np_cluster.cpp ../src/cluster/cluster.cpp
NP_CLUSTER_OBJS=../src/cluster/np_cluster.o ../src/cluster/cluster.o
NP_CLUSTER_BINS=cluster/np_cluster
NP_INCLUSION_SRCS=../src/inclusion/np_inclusion.cpp ../src/inclusion/inclusion.cpp
NP_INCLUSION_OBJS=../src/inclusion/np_inclusion.o ../src/inclusion/inclusion.o
NP_INCLUSION_BINS=inclusion/np_inclusion
NP_SPHERE_SRCS=../src/sphere/np_sphere.cpp ../src/sphere/sphere.cpp
NP_SPHERE_OBJS=../src/sphere/np_sphere.o ../src/sphere/sphere.o
NP_SPHERE_BINS=sphere/np_sphere
NP_TRAPPING_SRCS=../src/trapping/np_trapping.cpp ../src/trapping/cfrfme.cpp ../src/trapping/clffft.cpp
NP_TRAPPING_OBJS=../src/trapping/np_trapping.o ../src/trapping/cfrfme.o ../src/trapping/clffft.o
NP_TRAPPING_BINS=trapping/np_trapping
NP_TESTING_OBJS=../src/testing/test_ParticleDescriptor.o ../src/testing/test_TEDF.o ../src/testing/test_TTMS.o
NP_TESTING_BINS=testing/test_ParticleDescriptor testing/test_TEDF testing/test_TTMS
NP_TESTING_OBJS=../src/testing/test_outputs.o ../src/testing/test_ParticleDescriptor.o ../src/testing/test_TEDF.o ../src/testing/test_TTMS.o
NP_TESTING_BINS=testing/test_outputs testing/test_ParticleDescriptor testing/test_TEDF testing/test_TTMS

all: $(NPTM_LIB) $(FORTRAN_BINS) $(NP_CLUSTER_BINS) $(NP_INCLUSION_BINS) $(NP_SPHERE_BINS) $(NP_TRAPPING_BINS) $(NP_TESTING_BINS)

docs: $(NP_LIBNPTM_SRCS) $(NP_CLUSTER_SRCS) $(NP_DOC_SRCS) $(NP_INCLUSION_SRCS) $(NP_SPHERE_SRCS) $(NP_TRAPPING_SRCS)
	cd ../doc/src; doxygen config.dox

libnptm/libnptm.a: $(NP_LIBNPTM_OBJS)
	$(AR) $(ARFLAGS) $@ $(NP_LIBNPTM_OBJS)

@@ -75,6 +83,9 @@ trapping/np_trapping: $(NPTM_LIB) $(NP_TRAPPING_OBJS)
testing/test_ParticleDescriptor: $(NPTM_LIB) ../src/testing/test_ParticleDescriptor.o
	$(CXX) $(CXXFLAGS) ../src/testing/test_ParticleDescriptor.o -o $@ $(CXXLDFLAGS)

testing/test_outputs: $(NPTM_LIB) ../src/testing/test_outputs.o
	$(CXX) $(CXXFLAGS) ../src/testing/test_outputs.o -o $@ $(CXXLDFLAGS)

testing/test_TEDF: $(NPTM_LIB) ../src/testing/test_TEDF.o
	$(CXX) $(CXXFLAGS) ../src/testing/test_TEDF.o -o $@ $(CXXLDFLAGS)

@@ -146,3 +157,4 @@ clean:
wipe:
	rm -rf $(FORTRAN_OBJS) $(NP_LIBNPTM_OBJS) $(NP_CLUSTER_OBJS) $(NP_INCLUSION_OBJS) $(NP_SPHERE_OBJS) $(NP_TRAPPING_OBJS) $(NP_TESTING_OBJS)
	rm -rf $(FORTRAN_BINS) libnptm/libnptm.a libnptm/libnptm.so $(NP_CLUSTER_BINS) $(NP_INCLUSION_BINS) $(NP_SPHERE_BINS) $(NP_TRAPPING_BINS) $(NP_TESTING_BINS)
	rm -rf ../doc/build
+329 −421

File changed.

Preview size limit exceeded, changes collapsed.

+6 −0
Original line number Diff line number Diff line
@@ -35,6 +35,12 @@
#include <cstdio>
#include <string>

#ifdef USE_MPI
#ifndef MPI_VERSION
#include <mpi.h>
#endif
#endif

#ifndef INCLUDE_TYPES_H_
#include "../include/types.h"
#endif
+73 −15
Original line number Diff line number Diff line
@@ -33,10 +33,6 @@
#ifndef INCLUDE_COMMONS_H_
#define INCLUDE_COMMONS_H_

#ifdef USE_MPI
#include <mpi.h>
#endif

class ParticleDescriptor;

/*! \brief Structure with essential MPI data.
@@ -78,58 +74,103 @@ public:
  ParticleDescriptor *c1;
  //! \brief Vector of geometric asymmetry factors.
  double *gaps;
  //! \brief Components of extinction contribution to radiation torque on a single sphere along k.
  double **tqse;
  //! \brief Components of polarized extinction contribution to radiation torque on a single sphere along k.
  dcomplex **tqspe;
  //! \brief Components of scattering contribution to radiation torque on a single sphere along k.
  double **tqss;
  //! \brief Components of polarized scattering contribution to radiation torque on a single sphere along k.
  dcomplex **tqsps;
  //! \brief L-dependent coefficients of the geometric asymmetry parameter.
  double ****zpv;
  //! \brief Mean geometric asymmetry parameters.
  double **gapm;
  //! \brief Mean geometric asymmetry parameters referred to polarization plane.
  dcomplex **gappm;
  //! \brief Imaginary part of the harmonic functions argument.
  double *argi;
  //! \brief Argument of the harmonic functions referred to the scattering plane.
  double *args;
  //! \brief Geometric asymmetry parameters.
  double **gap;
  //! \brief Geometric asymmetry parameters referred to polarization plane.
  dcomplex **gapp;
  //! \brief Components of extinction contribution to radiation torque on the cluster along k.
  double **tqce;
  //! \brief Components of extinction contribution to radiation torque on the cluster along k referred to polarization plane.
  dcomplex **tqcpe;
  //! \brief Components of scattering contribution to radiation torque on the cluster along k.
  double **tqcs;
  //! \brief Components of scattering contribution to radiation torque on the cluster along k referred to polarization plane.
  dcomplex **tqcps;
  //! \brief Variation of unitary radiation vector. QUESTION: correct?
  double *duk;
  //! \brief Cluster extinction cross-section components referred to scattering plane.
  double **cextlr;
  //! \brief Cluster extinction cross-section components referred to meridional plane.
  double **cext;
  //! \brief Cluster Mueller Transformation Matrix components referred to scattering plane.
  double **cmullr;
  //! \brief Cluster Mueller Transformation Matrix components referred to meridional plane.
  double **cmul;
  //! \brief Geometric asymmetry parameter components.
  double *gapv;
  //! \brief Radiation extinction torque components.
  double *tqev;
  //! \brief Radiation scattering torque components.
  double *tqsv;
  //! \brief Incident unitary vector components.
  double *u;
  //! \brief Scattered unitary vector components.
  double *us;
  //! \brief Normal unitary vector components.
  double *un;
  //! \brief Normal scattered unitary vector components.
  double *uns;
  //! \brief Incident unitary vector components on polarization plane.
  double *up;
  //! \brief Scattered unitary vector components on polarization plane.
  double *ups;
  //! \brief Mean unitary vector components normal to polarization plane.
  double *unmp;
  //! \brief Mean scattered unitary vector components normal to polarization plane.
  double *unsmp;
  //! \brief Mean incident unitary vector components on polarization plane.
  double *upmp;
  //! \brief Mean scattered unitary vector components on polarization plane.
  double *upsmp;
  //! \brief Scattering angle.
  double scan;
  //! \brief Control parameter on incidence direction referred to meridional plane.
  double cfmp;
  //! \brief Control parameter on scattering direction referred to meridional plane.
  double sfmp;
  //! \brief Control parameter on incidence direction referred to scattering plane.
  double cfsp;
  //! \brief Control parameter on scattering direction referred to scattering plane.
  double sfsp;
  double qsfi;
  //! \brief SQSFI = XI^-2
  double sqsfi;
  //! \brief Vectorized scattering coefficient matrix.
  dcomplex *am_vector;
  //! \brief Scattering coefficient matrix.
  dcomplex **am;
  //! \brief Argument of harmonic functions. QUESTION: correct?
  dcomplex arg;
  //! \brief Vacuum magnitude of wave vector.
  double vk;
  //! \brief Wave number.
  double wn;
  //! \brief Normalization scale. QUESTION: correct?
  double xip;
  //! \brief Number of scales (wavelengths) to be computed.
  int number_of_scales;
  //! \brief Size of the block of scales handled by the current process.
  int xiblock;
  //! \brief Index of the first scale handled by the current process.
  int firstxi;
  //! \brief Index of the last scale handled by the current process.
  int lastxi;
  //! \brief ID of the GPU used by one MPI process.
  int proc_device;
@@ -140,11 +181,27 @@ public:
  //! \brief Required accuracy level.
  double accuracygoal;

  /*! \brief `ClusterIterationData` default instance constructor.
   *
   * \param gconf: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` object.
   * \param sconf: `ScattererConfiguration *` Pointer to a `ScattererConfiguration` object.
   * \param mpidata: `mixMPI *` Pointer to a `mixMPI` object.
   * \param device_count: `const int` Number of offload devices available on the system.
   */
  ClusterIterationData(GeometryConfiguration *gconf, ScattererConfiguration *sconf, const mixMPI *mpidata, const int device_count);
  
  /*! \brief `ClusterIterationData` copy constructor.
   *
   * \param rhs: `const ClusterIterationData &` Reference to the `ClusterIterationData` object to be copied.
   */
  ClusterIterationData(const ClusterIterationData& rhs);

#ifdef MPI_VERSION
  /*! \brief `ClusterIterationData` MPI constructor.
   *
   * \param mpidata: `const mixMPI *` Pointer to a `mixMPI` instance.
   * \param device_count: `const int` Number of offload devices available on the system.
   */
  ClusterIterationData(const mixMPI *mpidata, const int device_count);

  /*! \brief Broadcast over MPI the ClusterIterationData instance from MPI process 0 to all others.
@@ -157,10 +214,11 @@ public:
   * \param mpidata: `mixMPI *` Pointer to the mpi structure used to do the MPI broadcast.
   */
  void mpibcast(const mixMPI *mpidata);
#endif
#endif // MPI_VERSION

  /*! \brief `ClusterIterationData` instance destroyer.
   */
  ~ClusterIterationData();

};

/*! \brief Basic data structure describing the particle model and its interaction with fields.
@@ -322,7 +380,7 @@ public:
  dcomplex *dlri;
  //! \brief Vector of dielectric constants.
  dcomplex *dc0;
  //! \brief TBD
  //! \brief Vector of complex refractive indices.
  dcomplex *vkt;
  //! \brief Vector of sizes in units of 2*PI/LAMBDA
  double *vsz;
@@ -352,23 +410,23 @@ public:
  // >>> END OF SECTION NEEDED BY SPHERE AND CLUSTER <<< //

  // >>> NEEDED BY CLUSTER <<<
  // \brief Vector of field intensity components.
  //! \brief Vector of field intensity components.
  dcomplex *vintt;
  //! \brief Total forward scattering amplitude.
  //! \brief Total forward scattering amplitude of the spheres.
  dcomplex tfsas;
  //! \brief Total scattering amplitude.
  //! \brief Total scattering amplitude of the spheres.
  dcomplex **tsas;
  //! \brief Total scattering cross-section.
  //! \brief Sphere scattering cross-section.
  double scs;
  //! \brief Total extinction cross-section.
  //! \brief Sphere extinction cross-section.
  double ecs;
  //! \brief Total absorption cross-section.
  //! \brief Sphere absorption cross-section.
  double acs;
  //! \brief TBD.
  dcomplex **gis;
  //! \brief TBD.
  dcomplex **gls;
  //! \brief TBD.
  //! \brief Mean scattering amplitude components.
  dcomplex **sam;
  // >>> END OF SECTION NEEDED BY CLUSTER <<< //
  
Loading