From 6eaeee77869b5015d8878babe6dccd439bb2cb95 Mon Sep 17 00:00:00 2001 From: Mu Yang Date: Mon, 11 Sep 2017 16:08:19 +0800 Subject: [PATCH 1/8] Move MKL/OpenMP related routine to libisvd_la_*.so. --- demo/CMakeLists.txt | 4 + demo/ctest.c | 40 ++++++ include/c/isvd.h | 1 - include/c/isvd/gpu/@x@_stage.h | 8 +- include/c/isvd/la/vsl.h | 7 + include/c/isvd/la/vsl/driver.h | 35 +++++ include/c/isvd/util/omp.h | 1 + src/CMakeLists.txt | 3 +- src/libisvd.h | 2 +- src/libisvd/core/env.c | 7 +- .../@x@_integrate_hierarchical_reduction.c | 4 +- .../stage/@x@_integrate_kolmogorov_nagumo.c | 4 +- .../core/stage/@x@_integrate_wen_yin.c | 4 +- .../core/stage/@x@_orthogonalize_gramian.c | 4 +- .../stage/@x@_orthogonalize_tall_skinny_qr.c | 4 +- src/libisvd/core/stage/@x@_postprocess.h | 2 +- .../core/stage/@x@_postprocess_gramian.c | 4 +- .../core/stage/@x@_postprocess_symmetric.c | 4 +- .../stage/@x@_postprocess_tall_skinny_qr.c | 4 +- src/libisvd/core/stage/@x@_sketch.h | 43 +----- .../stage/@x@_sketch_gaussian_projection.c | 4 +- src/libisvd/def.h | 37 ----- src/libisvd/gpu.h | 2 - src/libisvd/gpu/stage/@x@_postprocess_gpu.h | 2 +- .../gpu/stage/@x@_postprocess_gramian_gpu.c | 2 +- .../gpu/stage/@x@_postprocess_symmetric_gpu.c | 2 +- .../@x@_postprocess_tall_skinny_qr_gpu.c | 2 +- .../@x@_sketch_gaussian_projection_gpu.c | 2 +- src/libisvd/gpu/stage/@x@_sketch_gpu.h | 42 +----- src/libisvd/la.h | 12 ++ src/libisvd/la/blas/dimm.c | 2 +- src/libisvd/la/blas/dism.c | 2 +- src/libisvd/la/blas/gemmt.c | 2 +- src/libisvd/la/blas/iamax.c | 2 +- src/libisvd/la/blas/iamin.c | 2 +- src/libisvd/la/blas/omatcopy.c | 2 +- src/libisvd/la/def.h | 58 ++++++++ src/libisvd/la/lapack/geinv.c | 2 +- src/libisvd/la/lapack/gesvd.c | 2 +- src/libisvd/la/lapack/lsame.c | 2 +- src/libisvd/la/lapack/syev.c | 2 +- src/libisvd/la/util/memory.c | 127 ++++++++++++++++++ src/libisvd/la/util/omp.c | 63 +++++++++ src/libisvd/la/vml/div.c | 2 +- src/libisvd/la/vml/mul.c | 2 +- src/libisvd/la/vml/sqrt.c | 2 +- src/libisvd/la/vml/sub.c | 2 +- src/libisvd/la/vsl/@x@_rng_gaussian_driver.c | 40 ++++++ src/libisvd/la/vsl/rng_gaussian.c | 2 +- src/libisvd/la/vsl/service.c | 2 +- src/libisvd/util/io.c | 2 +- src/libisvd/util/memory.c | 120 +---------------- src/libisvd/util/omp.c | 33 +---- 53 files changed, 445 insertions(+), 322 deletions(-) create mode 100644 demo/ctest.c create mode 100644 include/c/isvd/la/vsl/driver.h create mode 100644 src/libisvd/la.h create mode 100644 src/libisvd/la/def.h create mode 100644 src/libisvd/la/util/memory.c create mode 100644 src/libisvd/la/util/omp.c create mode 100644 src/libisvd/la/vsl/@x@_rng_gaussian_driver.c diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index ba8b38a..b335642 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -29,3 +29,7 @@ include_directories("${PROJECT_CONFIG_DIR}/include/c") set_target(cdemo cdemo.c ${PROJECT_SOURCE_DIR}/data/a.mtx /dev/null /dev/null /dev/null) target_link_libraries(isvd_cdemo isvd extmmio) target_include_directories(isvd_cdemo ${SYSTEM} PUBLIC "${PROJECT_SOURCE_DIR}/ext") + +# C test +set_target(ctest ctest.c) +target_link_libraries(isvd_ctest isvd) diff --git a/demo/ctest.c b/demo/ctest.c new file mode 100644 index 0000000..c8e2fcb --- /dev/null +++ b/demo/ctest.c @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file demo/ctest.c +/// \brief The C test code +/// +/// \author Mu Yang <> +/// \copyright MIT License +/// + +#include +#include +#include +#include + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// Main function +/// +int main( int argc, char **argv ) { + + isvd_init(&argc, &argv, MPI_COMM_WORLD); + + const mpi_int_t mpi_size = isvd_getMpiSize(MPI_COMM_WORLD); + const mpi_int_t mpi_rank = isvd_getMpiRank(MPI_COMM_WORLD); + const mpi_int_t mpi_root = 0; + + if ( mpi_rank == mpi_root ) { + printf("iSVD C demo\n"); + isvd_printEnvironment(MPI_COMM_WORLD); + } + + const isvd_int_t m = 100; + const isvd_int_t n = 1000; + + double *a = isvd_dmalloc(m * n); + + isvd_vdRngGaussianDriver(0, 0, m*n, a, 0.0, 1.0); + + isvd_finalize(); + + return 0; +} diff --git a/include/c/isvd.h b/include/c/isvd.h index 49e5fc7..19656dc 100644 --- a/include/c/isvd.h +++ b/include/c/isvd.h @@ -9,7 +9,6 @@ #ifndef ISVD_H_ #define ISVD_H_ -#include #include #include #include diff --git a/include/c/isvd/gpu/@x@_stage.h b/include/c/isvd/gpu/@x@_stage.h index 5607219..6c0c1d1 100644 --- a/include/c/isvd/gpu/@x@_stage.h +++ b/include/c/isvd/gpu/@x@_stage.h @@ -18,7 +18,7 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_gpu_@x@_stage_module -/// \brief GPU Gaussian Projection Sketching (@xname@ precision) +/// \brief GPU Gaussian Projection Sketching (@xname@ precision). /// /// \copydetails isvd_@x@SketchGaussianProjection /// @@ -32,7 +32,7 @@ void isvd_@x@SketchGaussianProjection_gpu( //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_gpu_@x@_stage_module -/// \brief GPU Tall-Skinny QR Postprocessing (@xname@ precision) +/// \brief GPU Tall-Skinny QR Postprocessing (@xname@ precision). /// /// \copydetails isvd_@x@PostprocessTallSkinnyQr /// @@ -47,7 +47,7 @@ void isvd_@x@PostprocessTallSkinnyQr_gpu( //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_gpu_@x@_stage_module -/// \brief GPU Gramian Postprocessing (@xname@ precision) +/// \brief GPU Gramian Postprocessing (@xname@ precision). /// /// \copydetails isvd_@x@PostprocessGramian /// @@ -62,7 +62,7 @@ void isvd_@x@PostprocessGramian_gpu( //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_gpu_@x@_stage_module -/// \brief GPU Symmetric Postprocessing (@xname@ precision) +/// \brief GPU Symmetric Postprocessing (@xname@ precision). /// /// \copydetails isvd_@x@PostprocessSymmetric /// diff --git a/include/c/isvd/la/vsl.h b/include/c/isvd/la/vsl.h index 80d28f3..cda1f58 100644 --- a/include/c/isvd/la/vsl.h +++ b/include/c/isvd/la/vsl.h @@ -11,6 +11,7 @@ #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \defgroup c_la_vsl_service_module Service Routines @@ -24,4 +25,10 @@ /// \brief The VSL Distribution Generators /// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \defgroup c_la_vsl_driver_module Driver Generators +/// \ingroup c_la_vsl_module +/// \brief The VSL Driver Generators +/// + #endif // ISVD_LA_VSL_H_ diff --git a/include/c/isvd/la/vsl/driver.h b/include/c/isvd/la/vsl/driver.h new file mode 100644 index 0000000..2588958 --- /dev/null +++ b/include/c/isvd/la/vsl/driver.h @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file include/c/isvd/la/vsl/driver.h +/// \brief The VSL driver header. +/// +/// \author Mu Yang <> +/// \copyright MIT License +/// + +#ifndef ISVD_LA_VSL_DRIVER_H_ +#define ISVD_LA_VSL_DRIVER_H_ + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif // __cplusplus + +@ISVD_LA_BLAS_TYPE_DEFINE@ + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup c_la_vsl_driver_module +/// \brief Generates normally distributed random numbers in parallel. +//\{ +void isvd_vsRngGaussianDriver( const INT seed, const INT nskip, const INT n, REAL4 *r, const REAL4 a, const REAL4 sigma ); +void isvd_vdRngGaussianDriver( const INT seed, const INT nskip, const INT n, REAL8 *r, const REAL8 a, const REAL8 sigma ); +//\} + +@ISVD_LA_BLAS_TYPE_UNDEF@ + +#if defined(__cplusplus) +} +#endif // __cplusplus + +#endif // ISVD_LA_VSL_DRIVER_H_ diff --git a/include/c/isvd/util/omp.h b/include/c/isvd/util/omp.h index ebbea8c..2bf865b 100644 --- a/include/c/isvd/util/omp.h +++ b/include/c/isvd/util/omp.h @@ -15,6 +15,7 @@ extern "C" { #endif // __cplusplus +omp_int_t isvd_getOmpMaxSize( void ); omp_int_t isvd_getOmpSize( void ); omp_int_t isvd_getOmpRank( void ); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 369cf18..0a82892 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,9 +2,8 @@ isvd_set_config_var() +# Shared library SET(BUILD_SHARED_LIBS ON) - -# RPath SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_FOLDER}") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) diff --git a/src/libisvd.h b/src/libisvd.h index 1353227..f78447c 100644 --- a/src/libisvd.h +++ b/src/libisvd.h @@ -9,8 +9,8 @@ #ifndef LIBISVD_H_ #define LIBISVD_H_ -#include #include +#include #include #if defined(ISVD_USE_GPU) diff --git a/src/libisvd/core/env.c b/src/libisvd/core/env.c index fe1f5d4..3a1172a 100644 --- a/src/libisvd/core/env.c +++ b/src/libisvd/core/env.c @@ -39,11 +39,8 @@ void isvd_finalize_cpu( void ) { /// \note This routines displays the MPI environment. /// void isvd_printEnvironment_cpu( const isvd_MpiComm mpi_comm ) { - mpi_int_t mpi_size = isvd_getMpiSize(mpi_comm), omp_size; - ISVD_OMP_PARALLEL - { - omp_size = isvd_getOmpSize(); - } + mpi_int_t mpi_size = isvd_getMpiSize(mpi_comm); + omp_int_t omp_size = isvd_getOmpMaxSize(); printf("iSVD %s, %lu-bit isvd_int_t, %lu-bit pointer\n", ISVD_VERSION, sizeof(isvd_int_t) * 8, sizeof(void*) * 8); printf("%d MPI nodes, %d OpenMP threads per node\n\n", mpi_size, omp_size); diff --git a/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c b/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c index ca78300..7d41972 100644 --- a/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c +++ b/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c -/// \brief The Hierarchical Reduction Integration (@xname@ precision) +/// \brief The Hierarchical Reduction Integration (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Hierarchical Reduction Integration (@xname@ precision) +/// \brief Hierarchical Reduction Integration (@xname@ precision). /// /// \param[in] param The \ref isvd_Param "parameters". /// \param[in] argv, argc The arguments and its length. (not using) diff --git a/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c b/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c index 94e665d..1e040ce 100644 --- a/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c +++ b/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c -/// \brief The Kolmogorov-Nagumo Integration (@xname@ precision) +/// \brief The Kolmogorov-Nagumo Integration (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -16,7 +16,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Kolmogorov-Nagumo Integration (@xname@ precision) +/// \brief Kolmogorov-Nagumo Integration (@xname@ precision). /// /// \param[in] param The \ref isvd_Param "parameters". /// \param[in] argv, argc The arguments and its length.
diff --git a/src/libisvd/core/stage/@x@_integrate_wen_yin.c b/src/libisvd/core/stage/@x@_integrate_wen_yin.c index e2fae04..efcff4e 100644 --- a/src/libisvd/core/stage/@x@_integrate_wen_yin.c +++ b/src/libisvd/core/stage/@x@_integrate_wen_yin.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_integrate_wen_yin.c -/// \brief The Wen-Yin Integration (@xname@ precision) +/// \brief The Wen-Yin Integration (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Wen-Yin Integration (@xname@ precision) +/// \brief Wen-Yin Integration (@xname@ precision). /// /// \param[in] param The \ref isvd_Param "parameters". /// \param[in] argv, argc The arguments and its length.
diff --git a/src/libisvd/core/stage/@x@_orthogonalize_gramian.c b/src/libisvd/core/stage/@x@_orthogonalize_gramian.c index 64ae42f..f035033 100644 --- a/src/libisvd/core/stage/@x@_orthogonalize_gramian.c +++ b/src/libisvd/core/stage/@x@_orthogonalize_gramian.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_orthogonalize_gramian.c -/// \brief The Gramian Orthogonalization (@xname@ precision) +/// \brief The Gramian Orthogonalization (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Gramian Orthogonalization (@xname@ precision) +/// \brief Gramian Orthogonalization (@xname@ precision). /// /// \param[in] param The \ref isvd_Param "parameters". /// \param[in] argv, argc The arguments and its length. (not using) diff --git a/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c b/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c index 6a065ea..c50b5cc 100644 --- a/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c +++ b/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c -/// \brief The Tall-Skinny QR Orthogonalization (@xname@ precision) +/// \brief The Tall-Skinny QR Orthogonalization (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Tall-Skinny QR Orthogonalization (@xname@ precision) +/// \brief Tall-Skinny QR Orthogonalization (@xname@ precision). /// /// \attention Not implemented! /// diff --git a/src/libisvd/core/stage/@x@_postprocess.h b/src/libisvd/core/stage/@x@_postprocess.h index a42cb74..b655dea 100644 --- a/src/libisvd/core/stage/@x@_postprocess.h +++ b/src/libisvd/core/stage/@x@_postprocess.h @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_postprocess.h -/// \brief The Postprocessing utilities (@xname@ precision) +/// \brief The Postprocessing utilities (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License diff --git a/src/libisvd/core/stage/@x@_postprocess_gramian.c b/src/libisvd/core/stage/@x@_postprocess_gramian.c index 70c0528..18107b0 100644 --- a/src/libisvd/core/stage/@x@_postprocess_gramian.c +++ b/src/libisvd/core/stage/@x@_postprocess_gramian.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_postprocess_gramian.c -/// \brief The Gramian Postprocessing (@xname@ precision) +/// \brief The Gramian Postprocessing (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Gramian Postprocessing (@xname@ precision) +/// \brief Gramian Postprocessing (@xname@ precision). /// /// \param[in] param The \ref isvd_Param "parameters". /// \param[in] argv, argc The arguments and its length. (not using) diff --git a/src/libisvd/core/stage/@x@_postprocess_symmetric.c b/src/libisvd/core/stage/@x@_postprocess_symmetric.c index a862634..c9f35af 100644 --- a/src/libisvd/core/stage/@x@_postprocess_symmetric.c +++ b/src/libisvd/core/stage/@x@_postprocess_symmetric.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_postprocess_symmetric.c -/// \brief The Symmetric Postprocessing (@xname@ precision) +/// \brief The Symmetric Postprocessing (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Symmetric Postprocessing (@xname@ precision) +/// \brief Symmetric Postprocessing (@xname@ precision). /// /// \param[in] param The \ref isvd_Param "parameters". /// \param[in] argv, argc The arguments and its length. (not using) diff --git a/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c b/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c index da5bbe9..85dd516 100644 --- a/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c +++ b/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c -/// \brief The Tall-Skinny QR Postprocessing (@xname@ precision) +/// \brief The Tall-Skinny QR Postprocessing (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Tall-Skinny QR Postprocessing (@xname@ precision) +/// \brief Tall-Skinny QR Postprocessing (@xname@ precision). /// /// \attention Not implemented! /// diff --git a/src/libisvd/core/stage/@x@_sketch.h b/src/libisvd/core/stage/@x@_sketch.h index d594b76..056e938 100644 --- a/src/libisvd/core/stage/@x@_sketch.h +++ b/src/libisvd/core/stage/@x@_sketch.h @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_sketch.h -/// \brief The Sketching utilities (@xname@ precision) +/// \brief The Sketching utilities (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -63,26 +63,7 @@ static void sketchBlockCol( isvd_int_t seed_ = seed; MPI_Bcast(&seed_, sizeof(seed_), MPI_BYTE, mpi_root, param.mpi_comm); - - - ISVD_OMP_PARALLEL - { - omp_int_t omp_size = isvd_getOmpSize(); - omp_int_t omp_rank = isvd_getOmpRank(); - - isvd_int_t len = nj * Nl / omp_size; - isvd_int_t start = len * omp_rank; - if ( omp_rank == omp_size-1 ) { - len = nj * Nl - start; - } - - isvd_VSLStreamStatePtr stream; - isvd_vslNewStream(&stream, seed_); - isvd_vslSkipAheadStream(stream, (Nl * nb * param.mpi_rank + start) * 2); - isvd_v@x@RngGaussian(stream, len, omegat + start, 0.0, 1.0); - - isvd_vslDeleteStream(&stream); - } + isvd_v@x@RngGaussianDriver(seed_, Nl * nb * param.mpi_rank, nj * Nl, omegat, 0.0, 1.0); // ====================================================================================================================== // // Project @@ -143,25 +124,7 @@ static void sketchBlockRow( isvd_int_t seed_ = seed; MPI_Bcast(&seed_, sizeof(isvd_VSLStreamStatePtr), MPI_BYTE, mpi_root, param.mpi_comm); - - ISVD_OMP_PARALLEL - { - omp_int_t omp_size = isvd_getOmpSize(); - omp_int_t omp_rank = isvd_getOmpRank(); - - isvd_int_t len = n * Nl / omp_size; - isvd_int_t start = len * omp_rank; - if ( omp_rank == omp_size-1 ) { - len = n * Nl - start; - } - - isvd_VSLStreamStatePtr stream; - isvd_vslNewStream(&stream, seed_); - isvd_vslSkipAheadStream(stream, start * 2); - isvd_v@x@RngGaussian(stream, len, omegat + start, 0.0, 1.0); - - isvd_vslDeleteStream(&stream); - } + isvd_v@x@RngGaussianDriver(seed_, 0, n * Nl, omegat, 0.0, 1.0); // ====================================================================================================================== // // Project diff --git a/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c b/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c index 44feacf..458f128 100644 --- a/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c +++ b/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/core/stage/@x@_sketch_gaussian_projection.c -/// \brief The Gaussian Projection Sketching (@xname@ precision) +/// \brief The Gaussian Projection Sketching (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module -/// \brief Gaussian Projection Sketching (@xname@ precision) +/// \brief Gaussian Projection Sketching (@xname@ precision). /// /// \param[in] param The \ref isvd_Param "parameters". /// \param[in] argv, argc The arguments and its length. (not using) diff --git a/src/libisvd/def.h b/src/libisvd/def.h index 1333429..f57f009 100644 --- a/src/libisvd/def.h +++ b/src/libisvd/def.h @@ -10,55 +10,18 @@ #define LIBISVD_DEF_H_ #include - -#if defined(ISVD_USE_ILP64) && !defined(MKL_ILP64) - #define MKL_ILP64 -#else // ISVD_USE_ILP64 - #undef MKL_ILP64 -#endif // ISVD_USE_ILP64 - -#if defined(_OPENMP) - #if !defined(ISVD_USE_OMP) - #define ISVD_USE_OMP - #endif // ISVD_USE_OMP -#else // _OPENMP - #undef ISVD_USE_OMP -#endif // _OPENMP - -#if defined(ISVD_USE_OMP) - #include - #define ISVD_OMP_PARALLEL _Pragma("omp parallel") -#else - #define ISVD_OMP_PARALLEL -#endif // ISVD_USE_OMP - #include #if defined(ISVD_USE_GTEST) && defined(__cplusplus) #include #endif // ISVD_USE_GTEST - #define ISVD_UNUSED( x ) (void)(x) #if !defined(__cplusplus) || (__cplusplus < 201103L) #define nullptr NULL #endif -#if !defined(DOXYGEN_SHOULD_SKIP_THIS) -#if defined(ISVD_USE_MKL) - #define MKL_INT isvd_int_t - #define MKL_UINT isvd_uint_t - #define MKL_Complex8 _Complex float - #define MKL_Complex16 _Complex double -#endif // ISVD_USE_MKL -#endif // DOXYGEN_SHOULD_SKIP_THIS - -#if defined(ISVD_USE_MKL) - #include -#endif // ISVD_USE_MKL - - #if defined(__cplusplus) extern "C" { #endif // __cplusplus diff --git a/src/libisvd/gpu.h b/src/libisvd/gpu.h index a7e8367..a60be0b 100644 --- a/src/libisvd/gpu.h +++ b/src/libisvd/gpu.h @@ -9,6 +9,4 @@ #ifndef LIBISVD_GPU_H_ #define LIBISVD_GPU_H_ -#include - #endif // LIBISVD_GPU_H_ diff --git a/src/libisvd/gpu/stage/@x@_postprocess_gpu.h b/src/libisvd/gpu/stage/@x@_postprocess_gpu.h index ce11b3a..27ae4d6 100644 --- a/src/libisvd/gpu/stage/@x@_postprocess_gpu.h +++ b/src/libisvd/gpu/stage/@x@_postprocess_gpu.h @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/gpu/stage/@x@_postprocess_gpu.h -/// \brief The GPU Postprocessing utilities (@xname@ precision) +/// \brief The GPU Postprocessing utilities (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License diff --git a/src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c b/src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c index 1126374..9fe3a5b 100644 --- a/src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c +++ b/src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c -/// \brief The GPU Gramian Postprocessing (@xname@ precision) +/// \brief The GPU Gramian Postprocessing (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License diff --git a/src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c b/src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c index b2fe752..8936f62 100644 --- a/src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c +++ b/src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c -/// \brief The GPU Symmetric Postprocessing (@xname@ precision) +/// \brief The GPU Symmetric Postprocessing (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License diff --git a/src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c b/src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c index adbdbda..15a9388 100644 --- a/src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c +++ b/src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c -/// \brief The GPU Tall-Skinny QR Postprocessing (@xname@ precision) +/// \brief The GPU Tall-Skinny QR Postprocessing (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License diff --git a/src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c b/src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c index 8f476da..82479a0 100644 --- a/src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c +++ b/src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c -/// \brief The GPU Gaussian Projection Sketching (@xname@ precision) +/// \brief The GPU Gaussian Projection Sketching (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License diff --git a/src/libisvd/gpu/stage/@x@_sketch_gpu.h b/src/libisvd/gpu/stage/@x@_sketch_gpu.h index 199ce27..0e5574a 100644 --- a/src/libisvd/gpu/stage/@x@_sketch_gpu.h +++ b/src/libisvd/gpu/stage/@x@_sketch_gpu.h @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \file src/libisvd/gpu/stage/@x@_sketch_gpu.h -/// \brief The GPU Sketching utilities (@xname@ precision) +/// \brief The GPU Sketching utilities (@xname@ precision). /// /// \author Mu Yang <> /// \copyright MIT License @@ -100,25 +100,7 @@ static void sketchBlockCol( isvd_int_t seed_ = seed; MPI_Bcast(&seed_, sizeof(seed_), MPI_BYTE, mpi_root, param.mpi_comm); - - ISVD_OMP_PARALLEL - { - omp_int_t omp_size = isvd_getOmpSize(); - omp_int_t omp_rank = isvd_getOmpRank(); - - isvd_int_t len = nj * Nl / omp_size; - isvd_int_t start = len * omp_rank; - if ( omp_rank == omp_size-1 ) { - len = nj * Nl - start; - } - - isvd_VSLStreamStatePtr stream; - isvd_vslNewStream(&stream, seed_); - isvd_vslSkipAheadStream(stream, (Nl * nb * param.mpi_rank + start) * 2); - isvd_v@x@RngGaussian(stream, len, omegat + start, 0.0, 1.0); - - isvd_vslDeleteStream(&stream); - } + isvd_v@x@RngGaussianDriver(seed_, Nl * nb * param.mpi_rank, nj * Nl, omegat, 0.0, 1.0); // ====================================================================================================================== // // Project @@ -232,25 +214,7 @@ static void sketchBlockRow( isvd_int_t seed_ = seed; MPI_Bcast(&seed_, sizeof(isvd_VSLStreamStatePtr), MPI_BYTE, mpi_root, param.mpi_comm); - - ISVD_OMP_PARALLEL - { - omp_int_t omp_size = isvd_getOmpSize(); - omp_int_t omp_rank = isvd_getOmpRank(); - - isvd_int_t len = n * Nl / omp_size; - isvd_int_t start = len * omp_rank; - if ( omp_rank == omp_size-1 ) { - len = n * Nl - start; - } - - isvd_VSLStreamStatePtr stream; - isvd_vslNewStream(&stream, seed_); - isvd_vslSkipAheadStream(stream, start * 2); - isvd_v@x@RngGaussian(stream, len, omegat + start, 0.0, 1.0); - - isvd_vslDeleteStream(&stream); - } + isvd_v@x@RngGaussianDriver(seed_, 0, n * Nl, omegat, 0.0, 1.0); // ====================================================================================================================== // // Project diff --git a/src/libisvd/la.h b/src/libisvd/la.h new file mode 100644 index 0000000..3aae050 --- /dev/null +++ b/src/libisvd/la.h @@ -0,0 +1,12 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file src/libisvd/la.h +/// \brief The linear algebra header. +/// +/// \author Mu Yang <> +/// \copyright MIT License +/// + +#ifndef LIBISVD_LA_H_ +#define LIBISVD_LA_H_ + +#endif // LIBISVD_LA_H_ diff --git a/src/libisvd/la/blas/dimm.c b/src/libisvd/la/blas/dimm.c index 9c149e3..8c0fe05 100644 --- a/src/libisvd/la/blas/dimm.c +++ b/src/libisvd/la/blas/dimm.c @@ -7,7 +7,7 @@ /// #include -#include +#include #include #include diff --git a/src/libisvd/la/blas/dism.c b/src/libisvd/la/blas/dism.c index 8edca0e..b9e49e3 100644 --- a/src/libisvd/la/blas/dism.c +++ b/src/libisvd/la/blas/dism.c @@ -7,7 +7,7 @@ /// #include -#include +#include #include #include diff --git a/src/libisvd/la/blas/gemmt.c b/src/libisvd/la/blas/gemmt.c index b7011af..69dbb0c 100644 --- a/src/libisvd/la/blas/gemmt.c +++ b/src/libisvd/la/blas/gemmt.c @@ -7,7 +7,7 @@ /// #include -#include +#include #include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/blas/iamax.c b/src/libisvd/la/blas/iamax.c index eb49c68..ddce590 100644 --- a/src/libisvd/la/blas/iamax.c +++ b/src/libisvd/la/blas/iamax.c @@ -7,7 +7,7 @@ /// #include -#include +#include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/blas/iamin.c b/src/libisvd/la/blas/iamin.c index 26a8994..ddfed22 100644 --- a/src/libisvd/la/blas/iamin.c +++ b/src/libisvd/la/blas/iamin.c @@ -7,7 +7,7 @@ /// #include -#include +#include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/blas/omatcopy.c b/src/libisvd/la/blas/omatcopy.c index 502ebfe..aacab08 100644 --- a/src/libisvd/la/blas/omatcopy.c +++ b/src/libisvd/la/blas/omatcopy.c @@ -7,7 +7,7 @@ /// #include -#include +#include #include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/def.h b/src/libisvd/la/def.h new file mode 100644 index 0000000..f37d804 --- /dev/null +++ b/src/libisvd/la/def.h @@ -0,0 +1,58 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file src/libisvd/la/def.h +/// \brief The linear algebra definitions. +/// +/// \author Mu Yang <> +/// \copyright MIT License +/// + +#ifndef LIBISVD_LA_DEF_H_ +#define LIBISVD_LA_DEF_H_ + +#include + +#if defined(__cplusplus) +extern "C" { +#endif // __cplusplus + +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) + +#if defined(_OPENMP) + #if !defined(ISVD_USE_OMP) + #define ISVD_USE_OMP + #endif // ISVD_USE_OMP +#else // _OPENMP + #undef ISVD_USE_OMP +#endif // _OPENMP + +#if defined(ISVD_USE_OMP) + #include + #define ISVD_OMP_PARALLEL _Pragma("omp parallel") +#else + #define ISVD_OMP_PARALLEL +#endif // ISVD_USE_OMP + +#if defined(ISVD_USE_ILP64) && !defined(MKL_ILP64) + #define MKL_ILP64 +#else // ISVD_USE_ILP64 + #undef MKL_ILP64 +#endif // ISVD_USE_ILP64 + +#if defined(ISVD_USE_MKL) + #define MKL_INT isvd_int_t + #define MKL_UINT isvd_uint_t + #define MKL_Complex8 _Complex float + #define MKL_Complex16 _Complex double +#endif // ISVD_USE_MKL + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +#if defined(ISVD_USE_MKL) + #include +#endif // ISVD_USE_MKL + +#if defined(__cplusplus) +} +#endif // __cplusplus + +#endif // LIBISVD_LA_DEF_H_ diff --git a/src/libisvd/la/lapack/geinv.c b/src/libisvd/la/lapack/geinv.c index 0b1f670..36bed9b 100644 --- a/src/libisvd/la/lapack/geinv.c +++ b/src/libisvd/la/lapack/geinv.c @@ -7,7 +7,7 @@ /// #include -#include +#include #include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/lapack/gesvd.c b/src/libisvd/la/lapack/gesvd.c index b44c16f..a36e63f 100644 --- a/src/libisvd/la/lapack/gesvd.c +++ b/src/libisvd/la/lapack/gesvd.c @@ -7,7 +7,7 @@ /// #include -#include +#include #include #include diff --git a/src/libisvd/la/lapack/lsame.c b/src/libisvd/la/lapack/lsame.c index 169b964..cb1fd72 100644 --- a/src/libisvd/la/lapack/lsame.c +++ b/src/libisvd/la/lapack/lsame.c @@ -7,7 +7,7 @@ /// #include -#include +#include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/lapack/syev.c b/src/libisvd/la/lapack/syev.c index 4ba8573..15ded00 100644 --- a/src/libisvd/la/lapack/syev.c +++ b/src/libisvd/la/lapack/syev.c @@ -7,7 +7,7 @@ /// #include -#include +#include #include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/util/memory.c b/src/libisvd/la/util/memory.c new file mode 100644 index 0000000..693c990 --- /dev/null +++ b/src/libisvd/la/util/memory.c @@ -0,0 +1,127 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file src/libisvd/isvd/util/memory.c +/// \brief The memory utilities. +/// +/// \author Mu Yang <> +/// \copyright MIT License +/// + +#include +#include +#include +#include + +#if defined(ISVD_USE_MKL) + #define isvd_xmalloc( num, type ) (type*)(mkl_malloc(num * sizeof(type), 64)); +#else // ISVD_USE_MKL + #define isvd_xmalloc( num, type ) (type*)(malloc(num * sizeof(type))); +#endif // ISVD_USE_MKL + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup c_util_memory_module +/// \brief Allocates an array with size \a num. +/// +/// \param num The number of objects. +/// +/// \return The pointer to the array. +/// +//\{ +isvd_int_t* isvd_imalloc( const size_t num ) { + return isvd_xmalloc(num, isvd_int_t); +} + +float* isvd_smalloc( const size_t num ) { + return isvd_xmalloc(num, float); +} + +double* isvd_dmalloc( const size_t num ) { + return isvd_xmalloc(num, double); +} + +_Complex float* isvd_cmalloc( const size_t num ) { + return isvd_xmalloc(num, _Complex float); +} + +_Complex double* isvd_zmalloc( const size_t num ) { + return isvd_xmalloc(num, _Complex double); +} +//\} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup c_util_memory_module +/// \brief Deallocates \a ptr. +/// +/// \param ptr The pointer to the array. +/// +//\{ +void isvd_free( void *ptr ) { +#if defined(ISVD_USE_MKL) + mkl_free(ptr); +#else // ISVD_USE_MKL + free(ptr); +#endif // ISVD_USE_MKL +} +//\} + +#define isvd_xmemset0( ptr, num, type ) memset((void*)(ptr), 0, num * sizeof(type)); + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup c_util_memory_module +/// \brief Sets the memory to zero. +/// +/// \param ptr The destination pointer to the array. +/// \param num The number of objects. +/// +//\{ +void isvd_imemset0( isvd_int_t *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, isvd_int_t); +} + +void isvd_smemset0( float *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, float); +} + +void isvd_dmemset0( double *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, double); +} + +void isvd_cmemset0( _Complex float *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, _Complex float); +} + +void isvd_zmemset0( _Complex double *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, _Complex double); +} +//\} + +#define isvd_xmemcpy( dst, src, num, type ) memcpy((void*)(dst), (void*)(src), num * sizeof(type)); + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup c_util_memory_module +/// \brief Copies the array. +/// +/// \param dst The destination pointer to the array. +/// \param src The source pointer to the array. +/// \param num The number of objects. +/// +//\{ +void isvd_imemcpy( isvd_int_t *dst, const isvd_int_t *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, isvd_int_t); +} + +void isvd_smemcpy( float *dst, const float *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, float); +} + +void isvd_dmemcpy( double *dst, const double *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, double); +} + +void isvd_cmemcpy( _Complex float *dst, const _Complex float *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, _Complex float); +} + +void isvd_zmemcpy( _Complex double *dst, const _Complex double *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, _Complex double); +} +//\} diff --git a/src/libisvd/la/util/omp.c b/src/libisvd/la/util/omp.c new file mode 100644 index 0000000..6ff8096 --- /dev/null +++ b/src/libisvd/la/util/omp.c @@ -0,0 +1,63 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file src/libisvd/la/util/omp.c +/// \brief The OpenMP utilities. +/// +/// \author Mu Yang <> +/// \copyright MIT License +/// + +#include +#include + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup c_util_omp_module +/// \brief Returns the maximum number of threads +/// +/// \return The maximum number of threads. +/// +/// \attention This routine should be called outside of an OpenMP scope. +/// +omp_int_t isvd_getOmpMaxSize( void ) { + omp_int_t omp_size = 1; + + ISVD_OMP_PARALLEL + { + if ( isvd_getOmpRank() == 0 ) { + omp_size = isvd_getOmpSize(); + } + } + + return omp_size; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup c_util_omp_module +/// \brief Returns the number of threads in the current team. +/// +/// \return The number of threads in the current team. +/// +/// \attention This routine should be called within an OpenMP scope. +/// +omp_int_t isvd_getOmpSize( void ) { +#if defined(ISVD_USE_OMP) + return omp_get_num_threads(); +#else // ISVD_USE_OMP + return 1; +#endif // ISVD_USE_OMP +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup c_util_omp_module +/// \brief Returns a unique thread identification number within the current team. +/// +/// \return The thread identification number within the current team. +/// +/// \attention This routine should be called within an OpenMP scope. +/// +omp_int_t isvd_getOmpRank( void ) { +#if defined(ISVD_USE_OMP) + return omp_get_thread_num(); +#else // ISVD_USE_OMP + return 0; +#endif // ISVD_USE_OMP +} diff --git a/src/libisvd/la/vml/div.c b/src/libisvd/la/vml/div.c index 02a07cd..5e08711 100644 --- a/src/libisvd/la/vml/div.c +++ b/src/libisvd/la/vml/div.c @@ -7,7 +7,7 @@ /// #include -#include +#include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/vml/mul.c b/src/libisvd/la/vml/mul.c index 9d0bf89..69cad7d 100644 --- a/src/libisvd/la/vml/mul.c +++ b/src/libisvd/la/vml/mul.c @@ -7,7 +7,7 @@ /// #include -#include +#include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/vml/sqrt.c b/src/libisvd/la/vml/sqrt.c index 14325a9..ecb69c2 100644 --- a/src/libisvd/la/vml/sqrt.c +++ b/src/libisvd/la/vml/sqrt.c @@ -7,7 +7,7 @@ /// #include -#include +#include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/vml/sub.c b/src/libisvd/la/vml/sub.c index f8ae430..1e74fc1 100644 --- a/src/libisvd/la/vml/sub.c +++ b/src/libisvd/la/vml/sub.c @@ -7,7 +7,7 @@ /// #include -#include +#include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/vsl/@x@_rng_gaussian_driver.c b/src/libisvd/la/vsl/@x@_rng_gaussian_driver.c new file mode 100644 index 0000000..e440b67 --- /dev/null +++ b/src/libisvd/la/vsl/@x@_rng_gaussian_driver.c @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file src/libisvd/la/vsl/@x@_rng_gaussian_driver.c +/// \brief The VSL RngGaussian driver (@xname@ precision). +/// +/// \author Mu Yang <> +/// \copyright MIT License +/// + +#include +#include +#include +#include +#include + +void isvd_v@x@RngGaussianDriver( + const isvd_int_t seed, + const isvd_int_t nskip, + const isvd_int_t n, + @xtype@ *r, + const @xtype@ a, + const @xtype@ sigma +) { + ISVD_OMP_PARALLEL + { + omp_int_t omp_size = isvd_getOmpSize(); + omp_int_t omp_rank = isvd_getOmpRank(); + + isvd_int_t length = n / omp_size; + isvd_int_t start = length * omp_rank; + if ( omp_rank == omp_size-1 ) { + length = n - start; + } + + isvd_VSLStreamStatePtr stream; + isvd_vslNewStream(&stream, seed); + isvd_vslSkipAheadStream(stream, (nskip + start) * 2); + isvd_v@x@RngGaussian(stream, length, r + start, a, sigma); + isvd_vslDeleteStream(&stream); + } +} diff --git a/src/libisvd/la/vsl/rng_gaussian.c b/src/libisvd/la/vsl/rng_gaussian.c index 06f65f8..820d596 100644 --- a/src/libisvd/la/vsl/rng_gaussian.c +++ b/src/libisvd/la/vsl/rng_gaussian.c @@ -7,7 +7,7 @@ /// #include -#include +#include #include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/la/vsl/service.c b/src/libisvd/la/vsl/service.c index 07f6092..000e627 100644 --- a/src/libisvd/la/vsl/service.c +++ b/src/libisvd/la/vsl/service.c @@ -12,7 +12,7 @@ #endif // ISVD_USE_MKL #include -#include +#include @ISVD_LA_BLAS_TYPE_DEFINE@ diff --git a/src/libisvd/util/io.c b/src/libisvd/util/io.c index 5bd5f6d..d405f5b 100644 --- a/src/libisvd/util/io.c +++ b/src/libisvd/util/io.c @@ -19,7 +19,7 @@ //\{ void isvd_ifget( FILE *stream, isvd_int_t *varp ) { #if !defined(ISVD_USE_ILP64) - isvd_int_t info = fscanf(stream, "%"PRId32, varp); + isvd_int_t info = fscanf(stream, "%" PRId32, varp); #else // ISVD_USE_ILP64 isvd_int_t info = fscanf(stream, "%" PRId64, varp); #endif // ISVD_USE_ILP64 diff --git a/src/libisvd/util/memory.c b/src/libisvd/util/memory.c index a8f8eea..0bab52b 100644 --- a/src/libisvd/util/memory.c +++ b/src/libisvd/util/memory.c @@ -5,123 +5,5 @@ /// \author Mu Yang <> /// \copyright MIT License /// - -#include -#include -#include -#include - -#if defined(ISVD_USE_MKL) - #define isvd_xmalloc( num, type ) (type*)(mkl_malloc(num * sizeof(type), 64)); -#else // ISVD_USE_MKL - #define isvd_xmalloc( num, type ) (type*)(malloc(num * sizeof(type))); -#endif // ISVD_USE_MKL - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup c_util_memory_module -/// \brief Allocates an array with size \a num. -/// -/// \param num The number of objects. -/// -/// \return The pointer to the array. -/// -//\{ -isvd_int_t* isvd_imalloc( const size_t num ) { - return isvd_xmalloc(num, isvd_int_t); -} - -float* isvd_smalloc( const size_t num ) { - return isvd_xmalloc(num, float); -} - -double* isvd_dmalloc( const size_t num ) { - return isvd_xmalloc(num, double); -} - -_Complex float* isvd_cmalloc( const size_t num ) { - return isvd_xmalloc(num, _Complex float); -} - -_Complex double* isvd_zmalloc( const size_t num ) { - return isvd_xmalloc(num, _Complex double); -} -//\} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup c_util_memory_module -/// \brief Deallocates \a ptr. -/// -/// \param ptr The pointer to the array. -/// -//\{ -void isvd_free( void *ptr ) { -#if defined(ISVD_USE_MKL) - mkl_free(ptr); -#else // ISVD_USE_MKL - free(ptr); -#endif // ISVD_USE_MKL -} -//\} - -#define isvd_xmemset0( ptr, num, type ) memset((void*)(ptr), 0, num * sizeof(type)); - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup c_util_memory_module -/// \brief Sets the memory to zero. -/// -/// \param ptr The destination pointer to the array. -/// \param num The number of objects. -/// -//\{ -void isvd_imemset0( isvd_int_t *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, isvd_int_t); -} - -void isvd_smemset0( float *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, float); -} - -void isvd_dmemset0( double *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, double); -} - -void isvd_cmemset0( _Complex float *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, _Complex float); -} - -void isvd_zmemset0( _Complex double *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, _Complex double); -} -//\} - -#define isvd_xmemcpy( dst, src, num, type ) memcpy((void*)(dst), (void*)(src), num * sizeof(type)); - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup c_util_memory_module -/// \brief Copies the array. -/// -/// \param dst The destination pointer to the array. -/// \param src The source pointer to the array. -/// \param num The number of objects. +/// \note Implement in \ref src/libisvd/la/util/memory.c /// -//\{ -void isvd_imemcpy( isvd_int_t *dst, const isvd_int_t *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, isvd_int_t); -} - -void isvd_smemcpy( float *dst, const float *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, float); -} - -void isvd_dmemcpy( double *dst, const double *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, double); -} - -void isvd_cmemcpy( _Complex float *dst, const _Complex float *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, _Complex float); -} - -void isvd_zmemcpy( _Complex double *dst, const _Complex double *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, _Complex double); -} -//\} diff --git a/src/libisvd/util/omp.c b/src/libisvd/util/omp.c index b6cc124..df796a7 100644 --- a/src/libisvd/util/omp.c +++ b/src/libisvd/util/omp.c @@ -1,38 +1,9 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file include/c/isvd/util/omp.h +/// \file src/libisvd/util/omp.c /// \brief The OpenMP utilities. /// /// \author Mu Yang <> /// \copyright MIT License /// - -#include -#include - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup c_util_omp_module -/// \brief Returns the number of threads in the current team. -/// -/// \return The number of threads in the current team. -/// -omp_int_t isvd_getOmpSize( void ) { -#if defined(ISVD_USE_OMP) - return omp_get_num_threads(); -#else // ISVD_USE_OMP - return 1; -#endif // ISVD_USE_OMP -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \ingroup c_util_omp_module -/// \brief Returns a unique thread identification number within the current team. -/// -/// \return The thread identification number within the current team. +/// \note Implement in \ref src/libisvd/la/util/omp.c /// -omp_int_t isvd_getOmpRank( void ) { -#if defined(ISVD_USE_OMP) - return omp_get_thread_num(); -#else // ISVD_USE_OMP - return 0; -#endif // ISVD_USE_OMP -} From caf8c8f459a5b8d1cf0723bfad75af4ecd6d670c Mon Sep 17 00:00:00 2001 From: Mu Yang Date: Mon, 11 Sep 2017 16:39:01 +0800 Subject: [PATCH 2/8] Fix memory leaks. --- cmake/display.cmake | 4 ++++ cmake/options.cmake | 2 +- src/libisvd/gpu/stage/@x@_sketch_gpu.h | 1 + src/libisvd/util/memory.c | 2 ++ src/libisvd/util/omp.c | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/display.cmake b/cmake/display.cmake index d125268..3e635cd 100644 --- a/cmake/display.cmake +++ b/cmake/display.cmake @@ -153,4 +153,8 @@ if(ISVD_BUILD_BIN) if(ISVD_BLAS STREQUAL "MKL" AND NOT ISVD_OMP) message(${DEPRECATION} "${Esc}[1;33mOpenMP is not enabled. Recommended to use it for better performance.${Esc}[0m") endif() + + if(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_GREATER 7 AND ISVD_USE_GPU AND CMAKE_BUILD_TYPE STREQUAL "Debug") + message(${DEPRECATION} "${Esc}[1;33mGPU routines with GCC under 7.0 might crash in debug mode.${Esc}[0m") + endif() endif() diff --git a/cmake/options.cmake b/cmake/options.cmake index 3a3158c..70c46ff 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -79,4 +79,4 @@ endif() # Set environment variables list(APPEND ENVS "OMP_NUM_THREADS=${OMP_THRDS}") -list(APPEND ENVS "ASAN_OPTIONS=color=always:protect_shadow_gap=0:replace_intrin=0:detect_leaks=0") +list(APPEND ENVS "ASAN_OPTIONS=color=always:protect_shadow_gap=0") diff --git a/src/libisvd/gpu/stage/@x@_sketch_gpu.h b/src/libisvd/gpu/stage/@x@_sketch_gpu.h index 0e5574a..6643f89 100644 --- a/src/libisvd/gpu/stage/@x@_sketch_gpu.h +++ b/src/libisvd/gpu/stage/@x@_sketch_gpu.h @@ -141,6 +141,7 @@ static void sketchBlockCol( // Deallocate memory isvd_free(omegat); + isvd_free(yst_); magma_free(a_gpu); magma_free(omegat_gpu); magma_free(yst_gpu); diff --git a/src/libisvd/util/memory.c b/src/libisvd/util/memory.c index 0bab52b..3f19d97 100644 --- a/src/libisvd/util/memory.c +++ b/src/libisvd/util/memory.c @@ -7,3 +7,5 @@ /// /// \note Implement in \ref src/libisvd/la/util/memory.c /// + +#include \ No newline at end of file diff --git a/src/libisvd/util/omp.c b/src/libisvd/util/omp.c index df796a7..bd01dd1 100644 --- a/src/libisvd/util/omp.c +++ b/src/libisvd/util/omp.c @@ -7,3 +7,5 @@ /// /// \note Implement in \ref src/libisvd/la/util/omp.c /// + +#include \ No newline at end of file From db6d0a2dfe3480fd3780f3cfdbecc3e20c3212a0 Mon Sep 17 00:00:00 2001 From: Mu Yang Date: Tue, 12 Sep 2017 09:51:45 +0800 Subject: [PATCH 3/8] Update documentation. --- check/CMakeLists.txt | 2 +- .../@x@_integrate_hierarchical_reduction.cxx | 2 +- .../stage/@x@_integrate_kolmogorov_nagumo.cxx | 2 +- .../core/stage/@x@_integrate_wen_yin.cxx | 2 +- .../core/stage/@x@_orthogonalize_gramian.cxx | 2 +- .../core/stage/@x@_postprocess_gramian.cxx | 2 +- .../core/stage/@x@_postprocess_symmetric.cxx | 2 +- .../stage/@x@_sketch_gaussian_projection.cxx | 2 +- .../gpu/stage/@x@_postprocess_gramian_gpu.cxx | 2 +- .../stage/@x@_postprocess_symmetric_gpu.cxx | 2 +- .../@x@_sketch_gaussian_projection_gpu.cxx | 2 +- demo/CMakeLists.txt | 2 +- demo/cdemo.c | 2 +- doxygen/Doxyfile | 5 +- doxygen/example.dox | 3 + doxygen/ext/mkl.h | 4 ++ doxygen/ext/mpi.h | 4 ++ doxygen/ext/omp.h | 4 ++ doxygen/tutorial/core/example.dox | 12 +--- doxygen/tutorial/core/storage.dox | 58 +++++++++++++++++++ doxygen/tutorial/main.dox | 1 + include/c/isvd/def.h | 30 +++++++--- src/libisvd/la/util/memory.c | 2 +- 23 files changed, 117 insertions(+), 32 deletions(-) create mode 100644 doxygen/example.dox create mode 100644 doxygen/ext/mkl.h create mode 100644 doxygen/ext/mpi.h create mode 100644 doxygen/ext/omp.h create mode 100644 doxygen/tutorial/core/storage.dox diff --git a/check/CMakeLists.txt b/check/CMakeLists.txt index e22c4d4..059d90d 100644 --- a/check/CMakeLists.txt +++ b/check/CMakeLists.txt @@ -53,7 +53,7 @@ endfunction() include_directories("${PROJECT_CONFIG_DIR}/include/c" "${CMAKE_CURRENT_CONFIG_DIR}/src" "${PROJECT_CONFIG_DIR}/src" - SYSTEM "${PROJECT_SOURCE_DIR}/ext") + SYSTEM "${PROJECT_SOURCE_DIR}/ext/mmio") # Add subdirectories add_subdirectory(src) diff --git a/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx b/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx index d592a5a..5a4c58a 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx b/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx index a8f1cfd..3faa507 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx b/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx index 44f0729..919610b 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx b/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx index 26c7ef0..1047c95 100644 --- a/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx +++ b/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx b/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx index ce9152a..6d5d55f 100644 --- a/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx +++ b/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx b/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx index acfe9e0..2104ec2 100644 --- a/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx +++ b/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx b/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx index 4b7941e..02d11e7 100644 --- a/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx +++ b/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx index a208e06..c2d1831 100644 --- a/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx index 5737672..150e763 100644 --- a/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx index 31edc73..bae5068 100644 --- a/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index b335642..2c4baab 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -28,7 +28,7 @@ include_directories("${PROJECT_CONFIG_DIR}/include/c") # C demo set_target(cdemo cdemo.c ${PROJECT_SOURCE_DIR}/data/a.mtx /dev/null /dev/null /dev/null) target_link_libraries(isvd_cdemo isvd extmmio) -target_include_directories(isvd_cdemo ${SYSTEM} PUBLIC "${PROJECT_SOURCE_DIR}/ext") +target_include_directories(isvd_cdemo ${SYSTEM} PUBLIC "${PROJECT_SOURCE_DIR}/ext/mmio") # C test set_target(ctest ctest.c) diff --git a/demo/cdemo.c b/demo/cdemo.c index 7cae048..e71043b 100644 --- a/demo/cdemo.c +++ b/demo/cdemo.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Main function diff --git a/doxygen/Doxyfile b/doxygen/Doxyfile index 5a0d8cd..64e148b 100644 --- a/doxygen/Doxyfile +++ b/doxygen/Doxyfile @@ -152,7 +152,8 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = @PROJECT_CONFIG_DIR@ +STRIP_FROM_PATH = @CMAKE_CURRENT_CONFIG_DIR@ \ + @PROJECT_CONFIG_DIR@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -161,7 +162,7 @@ STRIP_FROM_PATH = @PROJECT_CONFIG_DIR@ # specify the list of include paths that are normally passed to the compiler # using the -I flag. -STRIP_FROM_INC_PATH = @PROJECT_CONFIG_DIR@ +STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't diff --git a/doxygen/example.dox b/doxygen/example.dox new file mode 100644 index 0000000..b4ed890 --- /dev/null +++ b/doxygen/example.dox @@ -0,0 +1,3 @@ +/** + \example demo/cdemo.c +*/ \ No newline at end of file diff --git a/doxygen/ext/mkl.h b/doxygen/ext/mkl.h new file mode 100644 index 0000000..e7d83fc --- /dev/null +++ b/doxygen/ext/mkl.h @@ -0,0 +1,4 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file ext/mkl.h +/// \brief The Intel MKL header. +/// diff --git a/doxygen/ext/mpi.h b/doxygen/ext/mpi.h new file mode 100644 index 0000000..a74402d --- /dev/null +++ b/doxygen/ext/mpi.h @@ -0,0 +1,4 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file ext/mpi.h +/// \brief The MPI header. +/// diff --git a/doxygen/ext/omp.h b/doxygen/ext/omp.h new file mode 100644 index 0000000..1de9750 --- /dev/null +++ b/doxygen/ext/omp.h @@ -0,0 +1,4 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// \file ext/omp.h +/// \brief The OpenMP header. +/// diff --git a/doxygen/tutorial/core/example.dox b/doxygen/tutorial/core/example.dox index b1dcde7..c35ce15 100644 --- a/doxygen/tutorial/core/example.dox +++ b/doxygen/tutorial/core/example.dox @@ -1,15 +1,9 @@ /** \page tutorial_core_example iSVD Example -

iSVD

+

iSVD Example

- iSVD solves an approximate low-rank singular value decomposition of matrix `a`. - -

Example

- - The following is an example of using \ref isvd_dIsvd "iSVD driver". The code is also available in `/demo/cdemo.c`. - - \includelineno demo/cdemo.c + \ref isvd_dIsvd "iSVD driver" solves an approximate low-rank singular value decomposition of matrix 𝑨. \ref demo/cdemo.c is an example code. In the following, we describe the details of each part of this example.

Initialize Environment

@@ -39,7 +33,7 @@

Get Executing Time

- iSVD also records the executing time of each stage. + The iSVD driver also records the executing time of each stage. \snippetlineno demo/cdemo.c display-time diff --git a/doxygen/tutorial/core/storage.dox b/doxygen/tutorial/core/storage.dox new file mode 100644 index 0000000..cf271c3 --- /dev/null +++ b/doxygen/tutorial/core/storage.dox @@ -0,0 +1,58 @@ +/** + @page tutorial_core_storage Block Parallelism Storage + +

Notations

+ + In the following, denote @ref isvd_Param::mpi_size "𝑃" as the number of MPI nodes, @ref isvd_Param::num_sketch "𝑁" as the number of sketches. + +

Block-Row Storage

+ + In Block-Row Parallelism, we storage the matrices in row-blocks. The 𝑗-th block is stored in the 𝑗-th MPI-rank. + + @f[ + 𝑨 = + \begin{bmatrix} + 𝘈^{(1)} \\ 𝘈^{(2)} \\ \vdots \\ 𝘈^{(P)} + \end{bmatrix}, + \qquad + 𝖄 = + \begin{bmatrix} + 𝔜^{(1)} \\ 𝔜^{(2)} \\ \vdots \\ 𝔜^{(P)} + \end{bmatrix}, + \qquad + 𝕼 = + \begin{bmatrix} + 𝔔^{(1)} \\ 𝔔^{(2)} \\ \vdots \\ 𝔔^{(P)} + \end{bmatrix}, + \qquad + \overline{𝑸} = + \begin{bmatrix} + \overline{𝘘}^{(1)} \\ \overline{𝘘}^{(2)} \\ \vdots \\ \overline{𝘘}^{(P)} + \end{bmatrix}, + \qquad + \widehat{𝑼} = + \begin{bmatrix} + \widehat{𝘜}^{(1)} \\ \widehat{𝘜}^{(2)} \\ \vdots \\ \widehat{𝘜}^{(P)} + \end{bmatrix}, + \qquad + \widehat{𝑽} = + \begin{bmatrix} + \widehat{𝘝}^{(1)} \\ \widehat{𝘝}^{(2)} \\ \vdots \\ \widehat{𝘝}^{(P)} + \end{bmatrix}. + @f] + + The row indices of the blocks are [@ref isvd_Param::rowidxbegin, @ref isvd_Param::rowidxend). + +

Block-Column Storage

+ + In Block-Column Parallelism, we storage the input matrix 𝑨 in row-blocks. The 𝑗-th block is stored in the 𝑗-th MPI-rank. + + @f[ + 𝑨 = + \begin{bmatrix} + 𝘈^{\langle 1 \rangle} & 𝘈^{\langle 2 \rangle} & \cdots & 𝘈^{\langle P \rangle} + \end{bmatrix},. + @f] + + The column indices of the blocks are [@ref isvd_Param::colidxbegin, @ref isvd_Param::colidxend). +*/ diff --git a/doxygen/tutorial/main.dox b/doxygen/tutorial/main.dox index b01f899..d46db47 100644 --- a/doxygen/tutorial/main.dox +++ b/doxygen/tutorial/main.dox @@ -5,4 +5,5 @@ - \subpage tutorial_core_example - \subpage tutorial_core_stage + - \subpage tutorial_core_storage */ diff --git a/include/c/isvd/def.h b/include/c/isvd/def.h index f4f9a2c..8108fa1 100644 --- a/include/c/isvd/def.h +++ b/include/c/isvd/def.h @@ -9,9 +9,11 @@ #ifndef ISVD_DEF_H_ #define ISVD_DEF_H_ +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) #if !defined(__STDC_FORMAT_MACROS) #define __STDC_FORMAT_MACROS -#endif +#endif // __STDC_FORMAT_MACROS +#endif // DOXYGEN_SHOULD_SKIP_THIS #include #include @@ -26,31 +28,41 @@ #undef imaginary #undef complex +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) #if !defined(__cplusplus) #define ISVD_UNKNOWN #else // __cplusplus #define ISVD_UNKNOWN ... #endif // __cplusplus +#endif // DOXYGEN_SHOULD_SKIP_THIS #if defined(__cplusplus) extern "C" { #endif // __cplusplus /// \ingroup c_core_module -/// \brief The type of index. +/// \brief The type of index. (N = 32/64) +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) #if !defined(ISVD_USE_ILP64) -typedef int32_t isvd_int_t; +typedef int32_t isvd_int_t; #else // ISVD_USE_ILP64 -typedef int64_t isvd_int_t; +typedef int64_t isvd_int_t; #endif // ISVD_USE_ILP64 +#else // DOXYGEN_SHOULD_SKIP_THIS) +typedef intN_t isvd_int_t; +#endif // DOXYGEN_SHOULD_SKIP_THIS /// \ingroup c_core_module -/// \brief The type of unsigned index. +/// \brief The type of unsigned index. (N = 32/64) +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) #if !defined(ISVD_USE_ILP64) -typedef uint32_t isvd_uint_t; +typedef uint32_t isvd_uint_t; #else // ISVD_USE_ILP64 -typedef uint64_t isvd_uint_t; +typedef uint64_t isvd_uint_t; #endif // ISVD_USE_ILP64 +#else // DOXYGEN_SHOULD_SKIP_THIS) +typedef uintN_t isvd_uint_t; +#endif // DOXYGEN_SHOULD_SKIP_THIS /// \ingroup c_core_module /// \brief The type of MPI index. @@ -62,7 +74,11 @@ typedef int omp_int_t; /// \ingroup c_core_module /// \brief The MPI communicator type. +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) typedef int isvd_MpiComm; +#else // DOXYGEN_SHOULD_SKIP_THIS) +typedef MPI_Comm isvd_MpiComm; +#endif // DOXYGEN_SHOULD_SKIP_THIS #if defined(__cplusplus) } diff --git a/src/libisvd/la/util/memory.c b/src/libisvd/la/util/memory.c index 693c990..8cf17f3 100644 --- a/src/libisvd/la/util/memory.c +++ b/src/libisvd/la/util/memory.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/isvd/util/memory.c +/// \file src/libisvd/la/util/memory.c /// \brief The memory utilities. /// /// \author Mu Yang <> From 5a0e7d0af7552e5205fb3bb5ea178be97e922373 Mon Sep 17 00:00:00 2001 From: Mu Yang Date: Wed, 13 Sep 2017 11:55:34 +0800 Subject: [PATCH 4/8] Add default arguments query to to iSVD driver. --- README.md | 16 +-- cmake/options.cmake | 2 +- demo/cdemo.c | 2 +- src/libisvd/core/driver/@x@_isvd.c | 118 ++++++++++++------ .../@x@_integrate_hierarchical_reduction.c | 10 +- .../stage/@x@_integrate_kolmogorov_nagumo.c | 3 + .../core/stage/@x@_integrate_wen_yin.c | 12 +- .../core/stage/@x@_orthogonalize_gramian.c | 10 +- .../stage/@x@_orthogonalize_tall_skinny_qr.c | 9 +- .../core/stage/@x@_postprocess_gramian.c | 10 +- .../core/stage/@x@_postprocess_symmetric.c | 9 +- .../stage/@x@_postprocess_tall_skinny_qr.c | 9 +- .../stage/@x@_sketch_gaussian_projection.c | 10 +- 13 files changed, 126 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index caa609c..316e56a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Integrated Singular Value Decomposition (iSVD) * https://github.com/emfomy/isvd ### Documentation -* http://emfomy.github.io/isvd +* Please download from https://github.com/emfomy/isvd/releases or build using `make doc` (see below) on your own computer. ### Author * Mu Yang <> @@ -69,13 +69,13 @@ The following table are the main options The following table are the main make rules -| Command | Detail | -|----------------|--------------------------------| -| `make all` | build all libraries | -| `make install` | install package | -| `make check` | build and run unit tests | -| `make doc` | build documentation | -| `make help` | display make-rules | +| Command | Detail | Options | +|----------------|--------------------------------|--------------------------------| +| `make all` | build all libraries | | +| `make install` | install package | | +| `make check` | build and run unit tests | Require `ISVD_BUILD_TEST` | +| `make doc` | build documentation | Require `ISVD_BUILD_DOC` | +| `make help` | display make-rules | | ## Usage diff --git a/cmake/options.cmake b/cmake/options.cmake index 70c46ff..e5ea5f7 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -9,7 +9,7 @@ endif() option(ISVD_BUILD_LIB "Build libraries." "ON") option(ISVD_BUILD_DEMO "Build demo codes." "ON") option(ISVD_BUILD_TEST "Build unit tests." "OFF") -option(ISVD_BUILD_DOC "Build documentation." "OFF") +option(ISVD_BUILD_DOC "Build documentation." "ON") option(ISVD_USE_GPU "Enable GPU support." "OFF") option(ISVD_VERBOSE_TEST "Verbose unit tests." "ON") diff --git a/demo/cdemo.c b/demo/cdemo.c index e71043b..7060168 100644 --- a/demo/cdemo.c +++ b/demo/cdemo.c @@ -53,7 +53,7 @@ int main( int argc, char **argv ) { if ( !mm_is_array(matcode) || !mm_is_real(matcode) || !mm_is_general(matcode) ) { if ( mpi_rank == mpi_root ) { fprintf(stderr, "Sorry, this application does not support "); - fprintf(stderr, "Market Market type: [%s]\n", mm_typecode_to_str(matcode)); + fprintf(stderr, "Matrix Market type: [%s]\n", mm_typecode_to_str(matcode)); MPI_Abort(MPI_COMM_WORLD, 1); } MPI_Barrier(MPI_COMM_WORLD); diff --git a/src/libisvd/core/driver/@x@_isvd.c b/src/libisvd/core/driver/@x@_isvd.c index 489da9d..2751b1a 100644 --- a/src/libisvd/core/driver/@x@_isvd.c +++ b/src/libisvd/core/driver/@x@_isvd.c @@ -94,36 +94,41 @@ /// \param[out] ut Replaced by the left singular vectors 𝑼 (row-major). /// \param[out] vt Replaced by the right singular vectors 𝑽 (row-major). /// +/// \note If \b argc ≠ `NULL` and \b argc[i] < 0, then a default argument query is assumed on the i-th stage; +/// the routine only returns the first \b retc[i] default arguments in \b retv[i]. +/// +/// \see isvd_Param +/// void isvd_@x@Isvd( - const char *alg_s, - const char *alg_o, - const char *alg_i, - const char *alg_p, - const isvd_int_t m, - const isvd_int_t n, - const isvd_int_t k, - const isvd_int_t p, - const isvd_int_t N, - const @xtype@ *argv[4], - const isvd_int_t argc[4], - @xtype@ *retv[4], - const isvd_int_t retc[4], - double time[4], - FILE *stream, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - @xtype@ *vt, - const isvd_int_t ldvt, - const isvd_int_t seed, - const mpi_int_t ut_root, - const mpi_int_t vt_root, - const mpi_int_t mpi_root, - const isvd_MpiComm mpi_comm + const char *alg_s, + const char *alg_o, + const char *alg_i, + const char *alg_p, + const isvd_int_t m, + const isvd_int_t n, + const isvd_int_t k, + const isvd_int_t p, + const isvd_int_t N, + const @xtype@ *argv[4], + const isvd_int_t argc[4], + @xtype@ *retv[4], + const isvd_int_t retc[4], + double time[4], + FILE *stream, + const char dista, + const char ordera, + const @xtype@ *a, + const isvd_int_t lda, + @xtype@ *s, + @xtype@ *ut, + const isvd_int_t ldut, + @xtype@ *vt, + const isvd_int_t ldvt, + const isvd_int_t seed, + const mpi_int_t ut_root, + const mpi_int_t vt_root, + const mpi_int_t mpi_root, + const isvd_MpiComm mpi_comm ) { const mpi_int_t mpi_rank = isvd_getMpiRank(MPI_COMM_WORLD); @@ -147,14 +152,6 @@ void isvd_@x@Isvd( isvd_fun_t fun_i = isvd_arg2@x@AlgI(alg_i_); isvd_fun_t fun_p = isvd_arg2@x@AlgP(alg_p_); - if ( stream != nullptr && mpi_rank == mpi_root ) { - fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameS(alg_s_)); - fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameO(alg_o_)); - fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameI(alg_i_)); - fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameP(alg_p_)); - fprintf(stream, "\n"); - } - // ====================================================================================================================== // // Create parameters @@ -187,6 +184,53 @@ void isvd_@x@Isvd( const isvd_int_t retc_i = (retv != nullptr) ? retc[2] : 0; const isvd_int_t retc_p = (retv != nullptr) ? retc[3] : 0; + // ====================================================================================================================== // + // Check stage arguments + + if ( argc_s > 0 ) isvd_assert_ne(argv_s, nullptr); + if ( argc_o > 0 ) isvd_assert_ne(argv_o, nullptr); + if ( argc_i > 0 ) isvd_assert_ne(argv_i, nullptr); + if ( argc_p > 0 ) isvd_assert_ne(argv_p, nullptr); + if ( retc_s > 0 ) isvd_assert_ne(retv_s, nullptr); + if ( retc_o > 0 ) isvd_assert_ne(retv_o, nullptr); + if ( retc_i > 0 ) isvd_assert_ne(retv_i, nullptr); + if ( retc_p > 0 ) isvd_assert_ne(retv_p, nullptr); + + // ====================================================================================================================== // + // Query stage arguments + + bool query = false; + if ( argc_s < 0 ) { + fun_s(param, argv_s, argc_s, retv_s, retc_s, dista, ordera, NULL, 1, NULL, 1, seed, mpi_root); + query = true; + } + if ( argc_o < 0 ) { + fun_o(param, argv_o, argc_o, retv_o, retc_o, NULL, 1); + query = true; + } + if ( argc_i < 0 ) { + fun_i(param, argv_i, argc_i, retv_i, retc_i, NULL, 1, NULL, 1); + query = true; + } + if ( argc_p < 0 ) { + fun_p(param, argv_p, argc_p, retv_p, retc_p, dista, ordera, NULL, 1, NULL, 1, NULL, NULL, 1, NULL, 1, ut_root, vt_root); + query = true; + } + if ( query ) { + return; + } + + // ====================================================================================================================== // + // Print arguments + + if ( stream != nullptr && mpi_rank == mpi_root ) { + fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameS(alg_s_)); + fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameO(alg_o_)); + fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameI(alg_i_)); + fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameP(alg_p_)); + fprintf(stream, "\n"); + } + // ====================================================================================================================== // // Allocate memory diff --git a/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c b/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c index 7d41972..1636fa6 100644 --- a/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c +++ b/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c @@ -41,13 +41,9 @@ void isvd_@x@IntegrateHierarchicalReduction( const isvd_int_t ldqt ) { - if ( argc < 0 ) { - return; - } - - ISVD_UNUSED(argv); - ISVD_UNUSED(retv); - ISVD_UNUSED(retc); + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc < 0 ) return; // ====================================================================================================================== // // Get parameters diff --git a/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c b/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c index 1e040ce..004b2ad 100644 --- a/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c +++ b/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c @@ -47,6 +47,9 @@ void isvd_@x@IntegrateKolmogorovNagumo( const isvd_int_t ldqt ) { + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + // ====================================================================================================================== // // Query arguments diff --git a/src/libisvd/core/stage/@x@_integrate_wen_yin.c b/src/libisvd/core/stage/@x@_integrate_wen_yin.c index efcff4e..f20fbaf 100644 --- a/src/libisvd/core/stage/@x@_integrate_wen_yin.c +++ b/src/libisvd/core/stage/@x@_integrate_wen_yin.c @@ -28,7 +28,14 @@ /// \param[in] param The \ref isvd_Param "parameters". /// \param[in] argv, argc The arguments and its length.
/// \b argv[0]: The maximum number of iteration.
-/// \b argv[1]: The tolerance of convergence condition. +/// \b argv[1]: The tolerance of convergence condition.
+/// \b argv[2]: The initial step size \f$ \tau_0 \f$.
+/// \b argv[3]: The maximum predicting step size \f$ \tau_\max \f$.
+/// \b argv[4]: The minimum predicting step size \f$ \tau_\min \f$.
+/// \b argv[5]: The maximum number of iteration in predicting step size.
+/// \b argv[6]: The scaling parameter for step size searching \f$ \beta \f$.
+/// \b argv[7]: The parameter for step size searching \f$ \sigma \f$.
+/// \b argv[8]: The parameter for next step searching \f$ \eta \f$. /// \param[in] retv, retc The return values and its length. ///
/// \param[in] yst, ldyst The row-block 𝕼 (\f$ m_b \times Nl \f$, row-major) and its leading dimension. @@ -54,6 +61,9 @@ void isvd_@x@IntegrateWenYin( const isvd_int_t ldqt ) { + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + // ====================================================================================================================== // // Query arguments diff --git a/src/libisvd/core/stage/@x@_orthogonalize_gramian.c b/src/libisvd/core/stage/@x@_orthogonalize_gramian.c index f035033..343c8a6 100644 --- a/src/libisvd/core/stage/@x@_orthogonalize_gramian.c +++ b/src/libisvd/core/stage/@x@_orthogonalize_gramian.c @@ -36,13 +36,9 @@ void isvd_@x@OrthogonalizeGramian( const isvd_int_t ldyst ) { - if ( argc < 0 ) { - return; - } - - ISVD_UNUSED(argv); - ISVD_UNUSED(retv); - ISVD_UNUSED(retc); + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc < 0 ) return; // ====================================================================================================================== // // Get parameters diff --git a/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c b/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c index c50b5cc..8be09dd 100644 --- a/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c +++ b/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c @@ -32,14 +32,11 @@ void isvd_@x@OrthogonalizeTallSkinnyQr( fprintf(stderr, "Tall-Skinny QR Orthogonalization is not implemented!\n"); - if ( argc < 0 ) { - return; - } + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc < 0 ) return; ISVD_UNUSED(param); - ISVD_UNUSED(argv); - ISVD_UNUSED(retv); - ISVD_UNUSED(retc); ISVD_UNUSED(yst); ISVD_UNUSED(ldyst); diff --git a/src/libisvd/core/stage/@x@_postprocess_gramian.c b/src/libisvd/core/stage/@x@_postprocess_gramian.c index 18107b0..25a557c 100644 --- a/src/libisvd/core/stage/@x@_postprocess_gramian.c +++ b/src/libisvd/core/stage/@x@_postprocess_gramian.c @@ -77,13 +77,9 @@ void isvd_@x@PostprocessGramian( const mpi_int_t vt_root ) { - if ( argc < 0 ) { - return; - } - - ISVD_UNUSED(argv); - ISVD_UNUSED(retv); - ISVD_UNUSED(retc); + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc < 0 ) return; // ====================================================================================================================== // // Get parameters diff --git a/src/libisvd/core/stage/@x@_postprocess_symmetric.c b/src/libisvd/core/stage/@x@_postprocess_symmetric.c index c9f35af..b35214a 100644 --- a/src/libisvd/core/stage/@x@_postprocess_symmetric.c +++ b/src/libisvd/core/stage/@x@_postprocess_symmetric.c @@ -77,13 +77,10 @@ void isvd_@x@PostprocessSymmetric( const mpi_int_t vt_root ) { - if ( argc < 0 ) { - return; - } + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc < 0 ) return; - ISVD_UNUSED(argv); - ISVD_UNUSED(retv); - ISVD_UNUSED(retc); ISVD_UNUSED(vt); ISVD_UNUSED(ldvt); diff --git a/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c b/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c index 85dd516..f086974 100644 --- a/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c +++ b/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c @@ -45,14 +45,11 @@ void isvd_@x@PostprocessTallSkinnyQr( fprintf(stderr, "Tall-Skinny QR Postprocessing is not implemented!\n"); - if ( argc < 0 ) { - return; - } + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc < 0 ) return; ISVD_UNUSED(param); - ISVD_UNUSED(argv); - ISVD_UNUSED(retv); - ISVD_UNUSED(retc); ISVD_UNUSED(dista); ISVD_UNUSED(ordera); ISVD_UNUSED(a); diff --git a/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c b/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c index 458f128..ca779b4 100644 --- a/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c +++ b/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c @@ -56,13 +56,9 @@ void isvd_@x@SketchGaussianProjection( const mpi_int_t mpi_root ) { - if ( argc < 0 ) { - return; - } - - ISVD_UNUSED(argv); - ISVD_UNUSED(retv); - ISVD_UNUSED(retc); + if ( argc > 0 ) isvd_assert_ne(argv, nullptr); + if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc < 0 ) return; // ====================================================================================================================== // // Check arguments From e597efbc4c483d737f7b215f791c84f46f76956c Mon Sep 17 00:00:00 2001 From: Mu Yang Date: Wed, 13 Sep 2017 16:20:01 +0800 Subject: [PATCH 5/8] Update folder structure. Update tutorial. --- CMakeLists.txt | 1 - README.md | 9 ++- check/CMakeLists.txt | 8 +- check/{src => lib}/CMakeLists.txt | 4 +- demo/CMakeLists.txt | 2 +- doxygen/Doxyfile | 3 +- doxygen/tutorial/core/example.dox | 36 ++++++++- doxygen/tutorial/core/notation.dox | 36 +++++++++ doxygen/tutorial/core/stage.dox | 40 ++++++++-- doxygen/tutorial/core/storage.dox | 48 ++++++------ doxygen/tutorial/main.dox | 1 + include/CMakeLists.txt | 11 --- share/isvd/isvd-config.cmake | 3 - src/CMakeLists.txt | 72 +----------------- src/include/CMakeLists.txt | 4 + {include => src/include}/c/isvd.h | 0 {include => src/include}/c/isvd/config.h | 0 {include => src/include}/c/isvd/core.h | 0 .../include}/c/isvd/core/@x@_driver.h | 0 .../include}/c/isvd/core/@x@_stage.h | 0 {include => src/include}/c/isvd/core/env.h | 0 {include => src/include}/c/isvd/core/param.h | 6 +- {include => src/include}/c/isvd/def.h | 0 {include => src/include}/c/isvd/gpu.h | 0 .../include}/c/isvd/gpu/@x@_stage.h | 0 {include => src/include}/c/isvd/gpu/env.h | 0 {include => src/include}/c/isvd/la.h | 0 {include => src/include}/c/isvd/la/blas.h | 0 .../include}/c/isvd/la/blas/blas1.h | 0 .../include}/c/isvd/la/blas/blas2.h | 0 .../include}/c/isvd/la/blas/blas3.h | 0 .../include}/c/isvd/la/blas/blas_like.h | 0 {include => src/include}/c/isvd/la/lapack.h | 0 .../include}/c/isvd/la/lapack/auxiliary.h | 0 .../include}/c/isvd/la/lapack/least_square.h | 0 .../c/isvd/la/lapack/linear_equation.h | 0 {include => src/include}/c/isvd/la/vml.h | 0 .../include}/c/isvd/la/vml/mathematical.h | 0 .../include}/c/isvd/la/vml/power_root.h | 0 {include => src/include}/c/isvd/la/vsl.h | 4 +- .../include}/c/isvd/la/vsl/distribution.h | 0 .../include}/c/isvd/la/vsl/driver.h | 0 .../include}/c/isvd/la/vsl/service.h | 0 {include => src/include}/c/isvd/util.h | 0 {include => src/include}/c/isvd/util/io.h | 0 {include => src/include}/c/isvd/util/memory.h | 0 {include => src/include}/c/isvd/util/mpi.h | 0 {include => src/include}/c/isvd/util/omp.h | 0 src/lib/CMakeLists.txt | 73 +++++++++++++++++++ src/{ => lib}/libisvd.h | 2 +- src/{ => lib}/libisvd/core.h | 2 +- src/{ => lib}/libisvd/core/@x@_arg.h | 2 +- src/{ => lib}/libisvd/core/driver/@x@_isvd.c | 32 ++++---- src/{ => lib}/libisvd/core/env.c | 4 +- src/{ => lib}/libisvd/core/param.c | 2 +- .../@x@_integrate_hierarchical_reduction.c | 6 +- .../stage/@x@_integrate_kolmogorov_nagumo.c | 6 +- .../core/stage/@x@_integrate_wen_yin.c | 6 +- .../core/stage/@x@_orthogonalize_gramian.c | 6 +- .../stage/@x@_orthogonalize_tall_skinny_qr.c | 6 +- .../libisvd/core/stage/@x@_postprocess.h | 2 +- .../core/stage/@x@_postprocess_gramian.c | 12 +-- .../core/stage/@x@_postprocess_symmetric.c | 12 +-- .../stage/@x@_postprocess_tall_skinny_qr.c | 6 +- src/{ => lib}/libisvd/core/stage/@x@_sketch.h | 2 +- .../stage/@x@_sketch_gaussian_projection.c | 12 +-- src/{ => lib}/libisvd/def.h | 2 +- src/{ => lib}/libisvd/gpu.h | 2 +- src/{ => lib}/libisvd/gpu/def.h | 2 +- src/{ => lib}/libisvd/gpu/env.c | 2 +- .../libisvd/gpu/stage/@x@_postprocess_gpu.h | 2 +- .../gpu/stage/@x@_postprocess_gramian_gpu.c | 2 +- .../gpu/stage/@x@_postprocess_symmetric_gpu.c | 2 +- .../@x@_postprocess_tall_skinny_qr_gpu.c | 2 +- .../@x@_sketch_gaussian_projection_gpu.c | 2 +- .../libisvd/gpu/stage/@x@_sketch_gpu.h | 2 +- src/{ => lib}/libisvd/la.h | 2 +- src/{ => lib}/libisvd/la/blas/dimm.c | 2 +- src/{ => lib}/libisvd/la/blas/dism.c | 2 +- src/{ => lib}/libisvd/la/blas/gemmt.c | 2 +- src/{ => lib}/libisvd/la/blas/iamax.c | 2 +- src/{ => lib}/libisvd/la/blas/iamin.c | 2 +- src/{ => lib}/libisvd/la/blas/omatcopy.c | 2 +- src/{ => lib}/libisvd/la/def.h | 2 +- src/{ => lib}/libisvd/la/lapack/geinv.c | 2 +- src/{ => lib}/libisvd/la/lapack/gesvd.c | 2 +- src/{ => lib}/libisvd/la/lapack/lsame.c | 2 +- src/{ => lib}/libisvd/la/lapack/syev.c | 2 +- src/{ => lib}/libisvd/la/util/memory.c | 2 +- src/{ => lib}/libisvd/la/util/omp.c | 2 +- src/{ => lib}/libisvd/la/vml/div.c | 2 +- src/{ => lib}/libisvd/la/vml/mul.c | 2 +- src/{ => lib}/libisvd/la/vml/sqrt.c | 2 +- src/{ => lib}/libisvd/la/vml/sub.c | 2 +- .../libisvd/la/vsl/@x@_rng_gaussian_driver.c | 2 +- src/{ => lib}/libisvd/la/vsl/rng_gaussian.c | 2 +- src/{ => lib}/libisvd/la/vsl/service.c | 2 +- src/{ => lib}/libisvd/nogpu/@x@_stage.c | 2 +- src/{ => lib}/libisvd/nogpu/env.c | 2 +- src/{ => lib}/libisvd/util.h | 2 +- src/{ => lib}/libisvd/util/arg.h | 2 +- src/{ => lib}/libisvd/util/function.h | 2 +- src/{ => lib}/libisvd/util/io.c | 2 +- src/{ => lib}/libisvd/util/memory.c | 4 +- src/{ => lib}/libisvd/util/mpi.c | 2 +- src/{ => lib}/libisvd/util/omp.c | 4 +- 106 files changed, 329 insertions(+), 236 deletions(-) rename check/{src => lib}/CMakeLists.txt (92%) create mode 100644 doxygen/tutorial/core/notation.dox delete mode 100644 include/CMakeLists.txt delete mode 100644 share/isvd/isvd-config.cmake create mode 100644 src/include/CMakeLists.txt rename {include => src/include}/c/isvd.h (100%) rename {include => src/include}/c/isvd/config.h (100%) rename {include => src/include}/c/isvd/core.h (100%) rename {include => src/include}/c/isvd/core/@x@_driver.h (100%) rename {include => src/include}/c/isvd/core/@x@_stage.h (100%) rename {include => src/include}/c/isvd/core/env.h (100%) rename {include => src/include}/c/isvd/core/param.h (94%) rename {include => src/include}/c/isvd/def.h (100%) rename {include => src/include}/c/isvd/gpu.h (100%) rename {include => src/include}/c/isvd/gpu/@x@_stage.h (100%) rename {include => src/include}/c/isvd/gpu/env.h (100%) rename {include => src/include}/c/isvd/la.h (100%) rename {include => src/include}/c/isvd/la/blas.h (100%) rename {include => src/include}/c/isvd/la/blas/blas1.h (100%) rename {include => src/include}/c/isvd/la/blas/blas2.h (100%) rename {include => src/include}/c/isvd/la/blas/blas3.h (100%) rename {include => src/include}/c/isvd/la/blas/blas_like.h (100%) rename {include => src/include}/c/isvd/la/lapack.h (100%) rename {include => src/include}/c/isvd/la/lapack/auxiliary.h (100%) rename {include => src/include}/c/isvd/la/lapack/least_square.h (100%) rename {include => src/include}/c/isvd/la/lapack/linear_equation.h (100%) rename {include => src/include}/c/isvd/la/vml.h (100%) rename {include => src/include}/c/isvd/la/vml/mathematical.h (100%) rename {include => src/include}/c/isvd/la/vml/power_root.h (100%) rename {include => src/include}/c/isvd/la/vsl.h (92%) rename {include => src/include}/c/isvd/la/vsl/distribution.h (100%) rename {include => src/include}/c/isvd/la/vsl/driver.h (100%) rename {include => src/include}/c/isvd/la/vsl/service.h (100%) rename {include => src/include}/c/isvd/util.h (100%) rename {include => src/include}/c/isvd/util/io.h (100%) rename {include => src/include}/c/isvd/util/memory.h (100%) rename {include => src/include}/c/isvd/util/mpi.h (100%) rename {include => src/include}/c/isvd/util/omp.h (100%) create mode 100644 src/lib/CMakeLists.txt rename src/{ => lib}/libisvd.h (93%) rename src/{ => lib}/libisvd/core.h (91%) rename src/{ => lib}/libisvd/core/@x@_arg.h (98%) rename src/{ => lib}/libisvd/core/driver/@x@_isvd.c (93%) rename src/{ => lib}/libisvd/core/env.c (93%) rename src/{ => lib}/libisvd/core/param.c (98%) rename src/{ => lib}/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c (95%) rename src/{ => lib}/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c (97%) rename src/{ => lib}/libisvd/core/stage/@x@_integrate_wen_yin.c (98%) rename src/{ => lib}/libisvd/core/stage/@x@_orthogonalize_gramian.c (94%) rename src/{ => lib}/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c (86%) rename src/{ => lib}/libisvd/core/stage/@x@_postprocess.h (98%) rename src/{ => lib}/libisvd/core/stage/@x@_postprocess_gramian.c (96%) rename src/{ => lib}/libisvd/core/stage/@x@_postprocess_symmetric.c (96%) rename src/{ => lib}/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c (91%) rename src/{ => lib}/libisvd/core/stage/@x@_sketch.h (98%) rename src/{ => lib}/libisvd/core/stage/@x@_sketch_gaussian_projection.c (91%) rename src/{ => lib}/libisvd/def.h (99%) rename src/{ => lib}/libisvd/gpu.h (90%) rename src/{ => lib}/libisvd/gpu/def.h (94%) rename src/{ => lib}/libisvd/gpu/env.c (98%) rename src/{ => lib}/libisvd/gpu/stage/@x@_postprocess_gpu.h (99%) rename src/{ => lib}/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c (90%) rename src/{ => lib}/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c (90%) rename src/{ => lib}/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c (90%) rename src/{ => lib}/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c (90%) rename src/{ => lib}/libisvd/gpu/stage/@x@_sketch_gpu.h (99%) rename src/{ => lib}/libisvd/la.h (90%) rename src/{ => lib}/libisvd/la/blas/dimm.c (97%) rename src/{ => lib}/libisvd/la/blas/dism.c (97%) rename src/{ => lib}/libisvd/la/blas/gemmt.c (98%) rename src/{ => lib}/libisvd/la/blas/iamax.c (97%) rename src/{ => lib}/libisvd/la/blas/iamin.c (98%) rename src/{ => lib}/libisvd/la/blas/omatcopy.c (98%) rename src/{ => lib}/libisvd/la/def.h (97%) rename src/{ => lib}/libisvd/la/lapack/geinv.c (98%) rename src/{ => lib}/libisvd/la/lapack/gesvd.c (98%) rename src/{ => lib}/libisvd/la/lapack/lsame.c (95%) rename src/{ => lib}/libisvd/la/lapack/syev.c (98%) rename src/{ => lib}/libisvd/la/util/memory.c (98%) rename src/{ => lib}/libisvd/la/util/omp.c (97%) rename src/{ => lib}/libisvd/la/vml/div.c (97%) rename src/{ => lib}/libisvd/la/vml/mul.c (97%) rename src/{ => lib}/libisvd/la/vml/sqrt.c (96%) rename src/{ => lib}/libisvd/la/vml/sub.c (97%) rename src/{ => lib}/libisvd/la/vsl/@x@_rng_gaussian_driver.c (94%) rename src/{ => lib}/libisvd/la/vsl/rng_gaussian.c (96%) rename src/{ => lib}/libisvd/la/vsl/service.c (97%) rename src/{ => lib}/libisvd/nogpu/@x@_stage.c (98%) rename src/{ => lib}/libisvd/nogpu/env.c (94%) rename src/{ => lib}/libisvd/util.h (91%) rename src/{ => lib}/libisvd/util/arg.h (97%) rename src/{ => lib}/libisvd/util/function.h (95%) rename src/{ => lib}/libisvd/util/io.c (96%) rename src/{ => lib}/libisvd/util/memory.c (73%) rename src/{ => lib}/libisvd/util/mpi.c (97%) rename src/{ => lib}/libisvd/util/omp.c (74%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3eed33..d8d9e5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,6 @@ include(cmake/vars.cmake) # Add subdirectories add_subdirectory(ext) -add_subdirectory(include) add_subdirectory(src) add_subdirectory(demo) add_subdirectory(share) diff --git a/README.md b/README.md index 316e56a..07f370f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Integrated Singular Value Decomposition (iSVD) * https://github.com/emfomy/isvd ### Documentation -* Please download from https://github.com/emfomy/isvd/releases or build using `make doc` (see below) on your own computer. +* Please download from https://github.com/emfomy/isvd/releases or build using **make doc** (see below) on your own computer. ### Author * Mu Yang <> @@ -33,9 +33,10 @@ Integrated Singular Value Decomposition (iSVD) Please use the following commands to create Makefiles ``` +cd mkdir build cd build -cmake +cmake .. ``` ### Options @@ -43,7 +44,7 @@ cmake Use the following command to set options ``` -ccmake +ccmake .. ``` The following table are the main options @@ -81,6 +82,8 @@ The following table are the main make rules * Define `ISVD_USE_ILP64` before include `isvd.h` to use 64-bit integer. * All 64bit libraries and executables are named with suffix "`_64`". +* The header files are located in `build/include` +* The libraries are located in `build/lib` ### Libraries diff --git a/check/CMakeLists.txt b/check/CMakeLists.txt index 059d90d..739f7af 100644 --- a/check/CMakeLists.txt +++ b/check/CMakeLists.txt @@ -50,13 +50,13 @@ function(ISVD_SET_TARGET_CHECK_GPU target) endfunction() # Set include paths -include_directories("${PROJECT_CONFIG_DIR}/include/c" - "${CMAKE_CURRENT_CONFIG_DIR}/src" - "${PROJECT_CONFIG_DIR}/src" +include_directories("${CMAKE_CURRENT_CONFIG_DIR}/lib" + "${PROJECT_BINARY_DIR}/include/c" + "${PROJECT_BINARY_DIR}/lib" SYSTEM "${PROJECT_SOURCE_DIR}/ext/mmio") # Add subdirectories -add_subdirectory(src) +add_subdirectory(lib) # Configure files isvd_configure_x_fn("${CMAKE_CURRENT_SOURCE_DIR}/check" "${CMAKE_CURRENT_CONFIG_DIR}/check" "${ISVD_S_TYPES}") diff --git a/check/src/CMakeLists.txt b/check/lib/CMakeLists.txt similarity index 92% rename from check/src/CMakeLists.txt rename to check/lib/CMakeLists.txt index bebedf5..293b51a 100644 --- a/check/src/CMakeLists.txt +++ b/check/lib/CMakeLists.txt @@ -1,9 +1,9 @@ -# The CMake setting of 'check/src' +# The CMake setting of 'check/lib' isvd_set_config_var() # Configure files -file(COPY "${PROJECT_CONFIG_DIR}/src/" DESTINATION "${CMAKE_CURRENT_CONFIG_DIR}") +file(COPY "${PROJECT_CONFIG_DIR}/src/lib/" DESTINATION "${CMAKE_CURRENT_CONFIG_DIR}") file(GLOB_RECURSE cfiles "${CMAKE_CURRENT_CONFIG_DIR}/*.c") foreach(cfile ${cfiles}) string(REGEX REPLACE "\\.c$" ".cxx" cxxfile ${cfile}) diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index 2c4baab..5447745 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -23,7 +23,7 @@ macro(SET_TARGET name files) endmacro() # Set include paths -include_directories("${PROJECT_CONFIG_DIR}/include/c") +include_directories("${PROJECT_BINARY_DIR}/include/c") # C demo set_target(cdemo cdemo.c ${PROJECT_SOURCE_DIR}/data/a.mtx /dev/null /dev/null /dev/null) diff --git a/doxygen/Doxyfile b/doxygen/Doxyfile index 64e148b..abc5966 100644 --- a/doxygen/Doxyfile +++ b/doxygen/Doxyfile @@ -153,7 +153,7 @@ FULL_PATH_NAMES = YES # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = @CMAKE_CURRENT_CONFIG_DIR@ \ - @PROJECT_CONFIG_DIR@ + @PROJECT_CONFIG_DIR@/src # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -786,7 +786,6 @@ WARN_LOGFILE = INPUT = @PROJECT_SOURCE_DIR@/README.md \ @PROJECT_CONFIG_DIR@/doxygen \ - @PROJECT_CONFIG_DIR@/include \ @PROJECT_CONFIG_DIR@/src # This tag can be used to specify the character encoding of the source files diff --git a/doxygen/tutorial/core/example.dox b/doxygen/tutorial/core/example.dox index c35ce15..f8eae07 100644 --- a/doxygen/tutorial/core/example.dox +++ b/doxygen/tutorial/core/example.dox @@ -1,5 +1,5 @@ /** - \page tutorial_core_example iSVD Example + \page tutorial_core_example Example Code

iSVD Example

@@ -9,13 +9,13 @@ The iSVD environment and random seed should be set up before calling the driver. \ref isvd_init also initialize the MPI environment and the MAGMA environment, and \ref isvd_printEnvironment display the the MPI environment and the MAGMA environment. - If one needs CPU only, one may use \ref isvd_init_cpu, \ref isvd_printEnvironment_cpu, and \ref isvd_finalize_cpu. + If one needs CPU only, one may use \ref isvd_init_cpu, \ref isvd_printEnvironment_cpu, and \ref isvd_finalize_cpu instead. \snippetlineno demo/cdemo.c init-isvd

Load Data

- In this example, we load the data from a Matrix Market format file. Note the all the MPI nodes should load the matrix. + In this example, we load the data from a Matrix Market format file. Note the all the MPI processors should load the matrix. \snippetlineno demo/cdemo.c load-data @@ -27,7 +27,7 @@

Run iSVD

- The iSVD driver compute the approximate low-rank singular value decomposition. See \ref isvd_dIsvd for the detail of the arguments. + The iSVD driver compute the approximate low-rank singular value decomposition. See \ref isvd_dIsvd for the detail of the arguments. The 𝑗-th MPI-rank stores the 𝑗-th block of the input matrix 𝑨 (see \ref tutorial_core_storage for detail). \snippetlineno demo/cdemo.c run-isvd @@ -43,4 +43,32 @@ \snippetlineno demo/cdemo.c final-isvd +

Possible Result

+ + The following are the possible results of the example code. One may use **make run_cdemo** to run \ref demo/cdemo.c. + + \code{.txt} + iSVD C demo + iSVD 1.2.0, 32-bit isvd_int_t, 64-bit pointer + 4 MPI processors, 4 OpenMP threads per process + + No GPU support + + Using Real Double Precision Gaussian Projection Sketching + Using Real Double Precision Gramian Orthogonalization + Using Real Double Precision Kolmogorov-Nagumo Integration + Using Real Double Precision Gramian Postprocessing + + Sketching ...................... done + Orthogonalizing ................ done + Integrating .................... done + Postprocessing ................. done + + Average total computing time: 0.085510 seconds. + Average sketching time: 0.030245 seconds. + Average orthogonalizing time: 0.028071 seconds. + Average integrating time: 0.026233 seconds. + Average postprocessing time: 0.000962 seconds. + \endcode + */ diff --git a/doxygen/tutorial/core/notation.dox b/doxygen/tutorial/core/notation.dox new file mode 100644 index 0000000..f786b2a --- /dev/null +++ b/doxygen/tutorial/core/notation.dox @@ -0,0 +1,36 @@ +/** + @page tutorial_core_notation Notations + +

Format Notations

+ Name | Format | Example + -------------------------------|----------------------------------------|-------------------------------- + scalars | normal italic | \f$m, \alpha, N\f$ + vectors | bold italic lowercase | \f$\boldsymbol{v}, \boldsymbol{\beta}\f$ + matrices | bold italic uppercase | \f$\boldsymbol{A}, \boldsymbol{\Omega}\f$ + combined matrices | bold Frankfurt uppercase | \f$\boldsymbol{\mathfrak{Q}}, \boldsymbol{\mathfrak{Y}}\f$ + submatrices | sans serif / Frankfurt uppercase | \f$\mathsf{U}, \mathfrak{Y}\f$ + things in \f$i\f$-th sketch | under-script bracketed | \f$\boldsymbol{Q}_{[i]}, \boldsymbol{Y}_{[i]}\f$ + things in \f$j\f$-th process | super-script parenthesized / angled | \f$\mathsf{V}^{(j)}, \mathsf{A}^{\langle j \rangle}\f$ + +

Parameter Notations

+ + - \f$m\f$: the number of rows of the input matrix \f$\boldsymbol{A}\f$. + - \f$n\f$: the number of columns of the input matrix \f$\boldsymbol{A}\f$. + - \f$k\f$: the desired rank of approximate SVD. + - \f$p\f$: the oversampling parameter. + - \f$l\f$: the dimension of randomized sketches, i.e., \f$l=k+p\f$. + - \f$N\f$: the number of random sketches. + - \f$P\f$: the number of MPI processors. + - \f$m_b\f$: the row dimensions of a row-block, i.e., \f$m_b = \lceil \frac{m}{P} \rceil\f$. + - \f$n_b\f$: the column dimensions of a column-block, i.e., \f$n_b = \lceil \frac{n}{P} \rceil\f$. + - \f$m^{(j)}\f$: the exact row dimensions of the \f$j\f$-th row-block. + - For \f$j < P-1\f$, \f$m^{(j)} = m_b\f$. + - For \f$j = P-1\f$, \f$m^{(j)} = m - m_b(P-1)\f$. + - \f$m^{(0)} + m^{(1)} + \dotsb + m^{(P-1)} = m\f$. + - \f$n^{(j)}\f$: the exact column dimensions of the \f$j\f$-th column-block. + - For \f$j < P-1\f$, \f$n^{(j)} = n_b\f$. + - For \f$j = P-1\f$, \f$n^{(j)} = n - n_b(P-1)\f$. + - \f$n^{(0)} + n^{(1)} + \dotsb + n^{(P-1)} = n\f$. + + \see isvd_Param +*/ diff --git a/doxygen/tutorial/core/stage.dox b/doxygen/tutorial/core/stage.dox index f94ae11..2754142 100644 --- a/doxygen/tutorial/core/stage.dox +++ b/doxygen/tutorial/core/stage.dox @@ -1,19 +1,45 @@ /** - \page tutorial_core_stage iSVD Stages + \page tutorial_core_stage Stages -

Sketching

+ The iSVD algorithm contains four stages: sketching, orthogonalization, integration, and postprocessing. - The sketching stage randomly sketches \ref isvd_Param::num_sketch "𝑁" rank-\ref isvd_Param::dim_sketch "𝑙" column subspaces \f$\boldsymbol{Y}_{[i]}\f$ of the input matrix \f$\boldsymbol{A}\f$. +

Flow Chart

+ + Stage | Input | Output + --------------------|----------------------------------------------------|-------------------------------- + sketching | \f$\boldsymbol{A}\f$ | \f$\boldsymbol{\mathfrak{Y}}\f$ + orthogonalization | \f$\boldsymbol{\mathfrak{Y}}\f$ | \f$\boldsymbol{\mathfrak{Q}}\f$ + integration | \f$\boldsymbol{\mathfrak{Q}}\f$ | \f$\overline{\boldsymbol{Q}}\f$ + postprocessing | \f$\boldsymbol{A}, \overline{\boldsymbol{Q}}\f$ | \f$\boldsymbol{U}, \boldsymbol{V}, \boldsymbol{\sigma}\f$ + + Note that the Frankfurt matrices are defined as + @f[ + \boldsymbol{\mathfrak{Y}} = + \begin{bmatrix} + \boldsymbol{Y}_{[0]} & \boldsymbol{Y}_{[1]} & \cdots & \boldsymbol{Y}_{[N-1]} + \end{bmatrix}, + \qquad + \boldsymbol{\mathfrak{Q}} = + \begin{bmatrix} + \boldsymbol{Q}_{[0]} & \boldsymbol{Q}_{[1]} & \cdots & \boldsymbol{Q}_{[N-1]} + \end{bmatrix}. + @f] + +

Details

+ +

Sketching

+ + The sketching stage randomly sketches 𝑁 rank-𝑙 column subspaces \f$\boldsymbol{Y}_{[i]}\f$ of the input matrix \f$\boldsymbol{A}\f$. - The \ref isvd_dSketchGaussianProjection "Gramian Projection Sketching" multiples \f$\boldsymbol{A}\f$ by some random matrices using Gaussian normal distribution. -

Orthogonalization

+

Orthogonalization

The orthogonalization stage computes an approximate basis \f$\boldsymbol{Q}_{[i]}\f$ for the range of the input matrix from those \f$\boldsymbol{Y}_{[i]}\f$. - The \ref isvd_dOrthogonalizeGramian "Gramian Orthogonalization" finds the orthonormal basis using the eigen-decomposition of \f$\boldsymbol{Y}_{[i]}^\top \boldsymbol{Y}_{[i]}\f$ — the Gramiam of \f$\boldsymbol{Y}_{[i]}\f$. -

Integration

+

Integration

The integration stage find a kind of average \f$\overline{\boldsymbol{Q}}\f$ of those \f$\boldsymbol{Q}_{[i]}\f$. @@ -21,9 +47,9 @@ - The \ref isvd_dIntegrateWenYin "Wen-Yin Integration" finds the average using line search proposed by Wen and Yin. - The \ref isvd_dIntegrateHierarchicalReduction "Hierarchical Reduction Integration" finds the average using divide and conquer algorithm. Note that it is faster but less accurate. -

Postprocessing

+

Postprocessing

- The postprocessing stage forms a rank-\ref isvd_Param::rank "𝑘" approximate SVD of \f$\boldsymbol{A}\f$ in the range of \f$\overline{\boldsymbol{Q}}\f$. + The postprocessing stage forms a rank-𝑘 approximate SVD of \f$\boldsymbol{A}\f$ in the range of \f$\overline{\boldsymbol{Q}}\f$. - The \ref isvd_dPostprocessGramian "Gramian Postprocessing" finds approximate SVD using the eigen-decomposition of \f$\overline{\boldsymbol{Q}}^\top \boldsymbol{A} \boldsymbol{A}^\top \overline{\boldsymbol{Q}}\f$. - The \ref isvd_dPostprocessSymmetric "Symmetric Postprocessing" finds approximate SVD using the eigen-decomposition of \f$\overline{\boldsymbol{Q}}^\top \boldsymbol{A} \overline{\boldsymbol{Q}}\f$ for symmetric input matrix \f$\boldsymbol{A}\f$. diff --git a/doxygen/tutorial/core/storage.dox b/doxygen/tutorial/core/storage.dox index cf271c3..cec1fa0 100644 --- a/doxygen/tutorial/core/storage.dox +++ b/doxygen/tutorial/core/storage.dox @@ -1,58 +1,58 @@ /** - @page tutorial_core_storage Block Parallelism Storage - -

Notations

- - In the following, denote @ref isvd_Param::mpi_size "𝑃" as the number of MPI nodes, @ref isvd_Param::num_sketch "𝑁" as the number of sketches. + @page tutorial_core_storage Parallelism Storage

Block-Row Storage

- In Block-Row Parallelism, we storage the matrices in row-blocks. The 𝑗-th block is stored in the 𝑗-th MPI-rank. + In Block-Row Parallelism, we storage the matrices in row-blocks. The \f$j\f$-th block is stored in the \f$j\f$-th MPI-rank. @f[ - 𝑨 = + \boldsymbol{A} = \begin{bmatrix} - 𝘈^{(1)} \\ 𝘈^{(2)} \\ \vdots \\ 𝘈^{(P)} + \mathsf{A}^{(0)} \\ \mathsf{A}^{(1)} \\ \vdots \\ \mathsf{A}^{(P-1)} \end{bmatrix}, \qquad - 𝖄 = + \boldsymbol{\mathfrak{Y}} = \begin{bmatrix} - 𝔜^{(1)} \\ 𝔜^{(2)} \\ \vdots \\ 𝔜^{(P)} + \mathfrak{Y}^{(0)} \\ \mathfrak{Y}^{(1)} \\ \vdots \\ \mathfrak{Y}^{(P-1)} \end{bmatrix}, \qquad - 𝕼 = + \boldsymbol{\mathfrak{Q}} = \begin{bmatrix} - 𝔔^{(1)} \\ 𝔔^{(2)} \\ \vdots \\ 𝔔^{(P)} + \mathfrak{Q}^{(0)} \\ \mathfrak{Q}^{(1)} \\ \vdots \\ \mathfrak{Q}^{(P-1)} \end{bmatrix}, \qquad - \overline{𝑸} = + \overline{\boldsymbol{Q}} = \begin{bmatrix} - \overline{𝘘}^{(1)} \\ \overline{𝘘}^{(2)} \\ \vdots \\ \overline{𝘘}^{(P)} + \overline{\mathsf{Q}}^{(0)} \\ \overline{\mathsf{Q}}^{(1)} \\ \vdots \\ \overline{\mathsf{Q}}^{(P-1)} \end{bmatrix}, \qquad - \widehat{𝑼} = + \boldsymbol{U} = \begin{bmatrix} - \widehat{𝘜}^{(1)} \\ \widehat{𝘜}^{(2)} \\ \vdots \\ \widehat{𝘜}^{(P)} + \mathsf{U}^{(0)} \\ \mathsf{U}^{(1)} \\ \vdots \\ \mathsf{U}^{(P-1)} \end{bmatrix}, \qquad - \widehat{𝑽} = + \boldsymbol{V} = \begin{bmatrix} - \widehat{𝘝}^{(1)} \\ \widehat{𝘝}^{(2)} \\ \vdots \\ \widehat{𝘝}^{(P)} + \mathsf{V}^{(0)} \\ \mathsf{V}^{(1)} \\ \vdots \\ \mathsf{V}^{(P-1)} \end{bmatrix}. @f] - The row indices of the blocks are [@ref isvd_Param::rowidxbegin, @ref isvd_Param::rowidxend). + The \f$j\f$-th block of the input matrices should contain \f$m^{(j)}\f$ rows, and the \f$j\f$-th block of the input matrices should contain \f$m_b\f$ rows. + + For example, let \f$\boldsymbol{A}\f$ be a matrix with 11 rows and \f$P\f$ is 4. Then \f$\mathsf{A}^{(0)}\f$ are the (0-2)-th rows, \f$\mathsf{A}^{(1)}\f$ are the (0-5)-th rows, \f$\mathsf{A}^{(2)}\f$ are the (6-8)-th rows, \f$\mathsf{A}^{(3)}\f$ are the (9-10)-th rows.

Block-Column Storage

- In Block-Column Parallelism, we storage the input matrix 𝑨 in row-blocks. The 𝑗-th block is stored in the 𝑗-th MPI-rank. + In Block-Column Parallelism, we storage the input matrix \f$\boldsymbol{A}\f$ in row-blocks. The \f$j\f$-th block is stored in the \f$j\f$-th MPI-rank. @f[ - 𝑨 = + \boldsymbol{A} = \begin{bmatrix} - 𝘈^{\langle 1 \rangle} & 𝘈^{\langle 2 \rangle} & \cdots & 𝘈^{\langle P \rangle} - \end{bmatrix},. + \mathsf{A}^{\langle 0 \rangle} & \mathsf{A}^{\langle 1 \rangle} & \cdots & \mathsf{A}^{\langle P-1 \rangle} + \end{bmatrix}. @f] - The column indices of the blocks are [@ref isvd_Param::colidxbegin, @ref isvd_Param::colidxend). + The \f$j\f$-th block of the input matrices should contain \f$n^{(j)}\f$ columns, and the \f$j\f$-th block of the input matrices should contain \f$n_b\f$ columns. + + For example, let \f$\boldsymbol{A}\f$ be a matrix with 11 columns and \f$P\f$ is 4. Then \f$\mathsf{A}^{\langle 0 \rangle}\f$ are the (0-2)-th columns, \f$\mathsf{A}^{\langle 1 \rangle}\f$ are the (0-5)-th columns, \f$\mathsf{A}^{\langle 2 \rangle}\f$ are the (6-8)-th columns, \f$\mathsf{A}^{\langle 3 \rangle}\f$ are the (9-10)-th columns. */ diff --git a/doxygen/tutorial/main.dox b/doxygen/tutorial/main.dox index d46db47..6d45c69 100644 --- a/doxygen/tutorial/main.dox +++ b/doxygen/tutorial/main.dox @@ -4,6 +4,7 @@

Subpages

- \subpage tutorial_core_example + - \subpage tutorial_core_notation - \subpage tutorial_core_stage - \subpage tutorial_core_storage */ diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt deleted file mode 100644 index 24c4f82..0000000 --- a/include/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# The CMake setting of 'include/' - -isvd_set_config_var() - -# Configure files -isvd_configure_x_fn("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_CONFIG_DIR}" "${ISVD_S_TYPES}") -isvd_configure_x_fn("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_CONFIG_DIR}" "${ISVD_D_TYPES}") -isvd_configure_fn("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_CONFIG_DIR}") - -# Set install rule -install(DIRECTORY "${CMAKE_CURRENT_CONFIG_DIR}/c/" DESTINATION include/c) diff --git a/share/isvd/isvd-config.cmake b/share/isvd/isvd-config.cmake deleted file mode 100644 index bfcc580..0000000 --- a/share/isvd/isvd-config.cmake +++ /dev/null @@ -1,3 +0,0 @@ -# Compute paths -set(ISVD_INCLUDES "@CMAKE_INSTALL_PREFIX@/include") -set(ISVD_LIBRARIES "@CMAKE_INSTALL_PREFIX@/@LIB_FOLDER@/libisvd.so") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a82892..8a9d2a0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,77 +7,13 @@ SET(BUILD_SHARED_LIBS ON) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_FOLDER}") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) -# Macro -macro(SET_TARGET target files) - # Set library - add_library(${target} SHARED ${files}) - isvd_set_target(${target}) - set_property(TARGET ${target} PROPERTY VERSION ${ISVD_VERSION}) - install(TARGETS ${target} LIBRARY DESTINATION ${LIB_FOLDER}) -endmacro() - -# Set include paths -include_directories("${PROJECT_CONFIG_DIR}/include/c" - "${CMAKE_CURRENT_CONFIG_DIR}") - # Configure files isvd_configure_x_fn("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_CONFIG_DIR}" "${ISVD_S_TYPES}") isvd_configure_x_fn("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_CONFIG_DIR}" "${ISVD_D_TYPES}") isvd_configure_fn("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_CONFIG_DIR}") -# Break -if(NOT ISVD_BUILD_LIB) - return() -endif() - -# libisvd -set_target(isvd /dev/null) -set_property(TARGET isvd PROPERTY LINKER_LANGUAGE C) - -# libisvd_core -file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/core/*" - "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/util/*") -set_target(isvd_core "${files}") -isvd_set_target_omp(isvd_core C) -isvd_set_target_mpi(isvd_core C) -isvd_set_target_blas(isvd_core) -target_link_libraries(isvd isvd_core) - -# libisvd_la -if(ISVD_OMP) - string(TOLOWER ${ISVD_OMP} isvd_omp) - set(isvd_omp "_${isvd_omp}") -else() - set(isvd_omp "") -endif() -if(ISVD_USE_MKL) - set(isvd_la isvd_la_mkl${isvd_omp}) -else() - set(isvd_la isvd_la_blas${isvd_omp}) -endif(ISVD_USE_MKL) -file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/la/*") -set_target(${isvd_la} "${files}") -isvd_set_target_omp(${isvd_la} C) -isvd_set_target_mpi(${isvd_la} C) -isvd_set_target_blas(${isvd_la}) -target_link_libraries(isvd ${isvd_la}) - -# libisvd_gpu_none -file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/nogpu/*") -set_target(isvd_gpu_none "${files}") -isvd_set_target_omp(isvd_gpu_none C) -isvd_set_target_mpi(isvd_gpu_none C) -isvd_set_target_blas(isvd_gpu_none) +add_subdirectory(include) +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_CONFIG_DIR}/include" "${PROJECT_BINARY_DIR}/include") -# libisvd_gpu -if(ISVD_USE_GPU) - file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/gpu/*") - set_target(isvd_gpu_magma "${files}") - isvd_set_target_omp(isvd_gpu_magma C) - isvd_set_target_mpi(isvd_gpu_magma C) - isvd_set_target_blas(isvd_gpu_magma) - isvd_set_target_gpu(isvd_gpu_magma) - target_link_libraries(isvd isvd_gpu_magma) -else() - target_link_libraries(isvd isvd_gpu_none) -endif(ISVD_USE_GPU) +add_subdirectory(lib) +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_CONFIG_DIR}/lib" "${PROJECT_BINARY_DIR}/lib") diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt new file mode 100644 index 0000000..c9c9494 --- /dev/null +++ b/src/include/CMakeLists.txt @@ -0,0 +1,4 @@ +# The CMake setting of 'src/include/' + +# Set install rule +install(DIRECTORY "${CMAKE_CURRENT_CONFIG_DIR}/c/" DESTINATION include/c) diff --git a/include/c/isvd.h b/src/include/c/isvd.h similarity index 100% rename from include/c/isvd.h rename to src/include/c/isvd.h diff --git a/include/c/isvd/config.h b/src/include/c/isvd/config.h similarity index 100% rename from include/c/isvd/config.h rename to src/include/c/isvd/config.h diff --git a/include/c/isvd/core.h b/src/include/c/isvd/core.h similarity index 100% rename from include/c/isvd/core.h rename to src/include/c/isvd/core.h diff --git a/include/c/isvd/core/@x@_driver.h b/src/include/c/isvd/core/@x@_driver.h similarity index 100% rename from include/c/isvd/core/@x@_driver.h rename to src/include/c/isvd/core/@x@_driver.h diff --git a/include/c/isvd/core/@x@_stage.h b/src/include/c/isvd/core/@x@_stage.h similarity index 100% rename from include/c/isvd/core/@x@_stage.h rename to src/include/c/isvd/core/@x@_stage.h diff --git a/include/c/isvd/core/env.h b/src/include/c/isvd/core/env.h similarity index 100% rename from include/c/isvd/core/env.h rename to src/include/c/isvd/core/env.h diff --git a/include/c/isvd/core/param.h b/src/include/c/isvd/core/param.h similarity index 94% rename from include/c/isvd/core/param.h rename to src/include/c/isvd/core/param.h index 59d849b..56e38fc 100644 --- a/include/c/isvd/core/param.h +++ b/src/include/c/isvd/core/param.h @@ -19,6 +19,8 @@ extern "C" { /// \ingroup c_core_module /// \brief The parameters. /// +/// \see \ref tutorial_core_notation +/// typedef struct { /// The MPI communicator. @@ -36,10 +38,10 @@ typedef struct { /// \f$n\f$ The number of columns of the matrix. const isvd_int_t ncol; - /// \f$m_j\f$ The number of rows of current MPI process. + /// \f$m^{(j)}\f$ The number of rows of current MPI process. const isvd_int_t nrow_proc; - /// \f$n_j\f$ The number of columns of current MPI process. + /// \f$n^{(j)}\f$ The number of columns of current MPI process. const isvd_int_t ncol_proc; /// \f$m_b = \lceil \frac{m}{P} \rceil\f$ The number of rows per MPI process. diff --git a/include/c/isvd/def.h b/src/include/c/isvd/def.h similarity index 100% rename from include/c/isvd/def.h rename to src/include/c/isvd/def.h diff --git a/include/c/isvd/gpu.h b/src/include/c/isvd/gpu.h similarity index 100% rename from include/c/isvd/gpu.h rename to src/include/c/isvd/gpu.h diff --git a/include/c/isvd/gpu/@x@_stage.h b/src/include/c/isvd/gpu/@x@_stage.h similarity index 100% rename from include/c/isvd/gpu/@x@_stage.h rename to src/include/c/isvd/gpu/@x@_stage.h diff --git a/include/c/isvd/gpu/env.h b/src/include/c/isvd/gpu/env.h similarity index 100% rename from include/c/isvd/gpu/env.h rename to src/include/c/isvd/gpu/env.h diff --git a/include/c/isvd/la.h b/src/include/c/isvd/la.h similarity index 100% rename from include/c/isvd/la.h rename to src/include/c/isvd/la.h diff --git a/include/c/isvd/la/blas.h b/src/include/c/isvd/la/blas.h similarity index 100% rename from include/c/isvd/la/blas.h rename to src/include/c/isvd/la/blas.h diff --git a/include/c/isvd/la/blas/blas1.h b/src/include/c/isvd/la/blas/blas1.h similarity index 100% rename from include/c/isvd/la/blas/blas1.h rename to src/include/c/isvd/la/blas/blas1.h diff --git a/include/c/isvd/la/blas/blas2.h b/src/include/c/isvd/la/blas/blas2.h similarity index 100% rename from include/c/isvd/la/blas/blas2.h rename to src/include/c/isvd/la/blas/blas2.h diff --git a/include/c/isvd/la/blas/blas3.h b/src/include/c/isvd/la/blas/blas3.h similarity index 100% rename from include/c/isvd/la/blas/blas3.h rename to src/include/c/isvd/la/blas/blas3.h diff --git a/include/c/isvd/la/blas/blas_like.h b/src/include/c/isvd/la/blas/blas_like.h similarity index 100% rename from include/c/isvd/la/blas/blas_like.h rename to src/include/c/isvd/la/blas/blas_like.h diff --git a/include/c/isvd/la/lapack.h b/src/include/c/isvd/la/lapack.h similarity index 100% rename from include/c/isvd/la/lapack.h rename to src/include/c/isvd/la/lapack.h diff --git a/include/c/isvd/la/lapack/auxiliary.h b/src/include/c/isvd/la/lapack/auxiliary.h similarity index 100% rename from include/c/isvd/la/lapack/auxiliary.h rename to src/include/c/isvd/la/lapack/auxiliary.h diff --git a/include/c/isvd/la/lapack/least_square.h b/src/include/c/isvd/la/lapack/least_square.h similarity index 100% rename from include/c/isvd/la/lapack/least_square.h rename to src/include/c/isvd/la/lapack/least_square.h diff --git a/include/c/isvd/la/lapack/linear_equation.h b/src/include/c/isvd/la/lapack/linear_equation.h similarity index 100% rename from include/c/isvd/la/lapack/linear_equation.h rename to src/include/c/isvd/la/lapack/linear_equation.h diff --git a/include/c/isvd/la/vml.h b/src/include/c/isvd/la/vml.h similarity index 100% rename from include/c/isvd/la/vml.h rename to src/include/c/isvd/la/vml.h diff --git a/include/c/isvd/la/vml/mathematical.h b/src/include/c/isvd/la/vml/mathematical.h similarity index 100% rename from include/c/isvd/la/vml/mathematical.h rename to src/include/c/isvd/la/vml/mathematical.h diff --git a/include/c/isvd/la/vml/power_root.h b/src/include/c/isvd/la/vml/power_root.h similarity index 100% rename from include/c/isvd/la/vml/power_root.h rename to src/include/c/isvd/la/vml/power_root.h diff --git a/include/c/isvd/la/vsl.h b/src/include/c/isvd/la/vsl.h similarity index 92% rename from include/c/isvd/la/vsl.h rename to src/include/c/isvd/la/vsl.h index cda1f58..f4e5d60 100644 --- a/include/c/isvd/la/vsl.h +++ b/src/include/c/isvd/la/vsl.h @@ -26,9 +26,9 @@ /// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \defgroup c_la_vsl_driver_module Driver Generators +/// \defgroup c_la_vsl_driver_module Drivers /// \ingroup c_la_vsl_module -/// \brief The VSL Driver Generators +/// \brief The VSL Drivers /// #endif // ISVD_LA_VSL_H_ diff --git a/include/c/isvd/la/vsl/distribution.h b/src/include/c/isvd/la/vsl/distribution.h similarity index 100% rename from include/c/isvd/la/vsl/distribution.h rename to src/include/c/isvd/la/vsl/distribution.h diff --git a/include/c/isvd/la/vsl/driver.h b/src/include/c/isvd/la/vsl/driver.h similarity index 100% rename from include/c/isvd/la/vsl/driver.h rename to src/include/c/isvd/la/vsl/driver.h diff --git a/include/c/isvd/la/vsl/service.h b/src/include/c/isvd/la/vsl/service.h similarity index 100% rename from include/c/isvd/la/vsl/service.h rename to src/include/c/isvd/la/vsl/service.h diff --git a/include/c/isvd/util.h b/src/include/c/isvd/util.h similarity index 100% rename from include/c/isvd/util.h rename to src/include/c/isvd/util.h diff --git a/include/c/isvd/util/io.h b/src/include/c/isvd/util/io.h similarity index 100% rename from include/c/isvd/util/io.h rename to src/include/c/isvd/util/io.h diff --git a/include/c/isvd/util/memory.h b/src/include/c/isvd/util/memory.h similarity index 100% rename from include/c/isvd/util/memory.h rename to src/include/c/isvd/util/memory.h diff --git a/include/c/isvd/util/mpi.h b/src/include/c/isvd/util/mpi.h similarity index 100% rename from include/c/isvd/util/mpi.h rename to src/include/c/isvd/util/mpi.h diff --git a/include/c/isvd/util/omp.h b/src/include/c/isvd/util/omp.h similarity index 100% rename from include/c/isvd/util/omp.h rename to src/include/c/isvd/util/omp.h diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt new file mode 100644 index 0000000..00643ce --- /dev/null +++ b/src/lib/CMakeLists.txt @@ -0,0 +1,73 @@ +# The CMake setting of 'src/lib' + +isvd_set_config_var() + +# Shared library +SET(BUILD_SHARED_LIBS ON) +SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_FOLDER}") +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) + +# Macro +macro(SET_TARGET target files) + # Set library + add_library(${target} SHARED ${files}) + isvd_set_target(${target}) + set_property(TARGET ${target} PROPERTY VERSION ${ISVD_VERSION}) + set_property(TARGET ${target} PROPERTY LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_CONFIG_DIR}") + install(TARGETS ${target} LIBRARY DESTINATION ${LIB_FOLDER}) +endmacro() + +# Set include paths +include_directories("${CMAKE_CURRENT_CONFIG_DIR}/../include/c" + "${CMAKE_CURRENT_CONFIG_DIR}") + +# Break +if(NOT ISVD_BUILD_LIB) + return() +endif() + +# libisvd +set_target(isvd /dev/null) +set_property(TARGET isvd PROPERTY LINKER_LANGUAGE C) + +# libisvd_core +file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/core/*" + "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/util/*") +set_target(isvd_core "${files}") +isvd_set_target_mpi(isvd_core C) +target_link_libraries(isvd isvd_core) + +# libisvd_la +if(ISVD_OMP) + string(TOLOWER ${ISVD_OMP} isvd_omp) + set(isvd_omp "_${isvd_omp}") +else() + set(isvd_omp "") +endif() +if(ISVD_USE_MKL) + set(isvd_la isvd_la_mkl${isvd_omp}) +else() + set(isvd_la isvd_la_blas${isvd_omp}) +endif(ISVD_USE_MKL) +file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/la/*") +set_target(${isvd_la} "${files}") +isvd_set_target_omp(${isvd_la} C) +isvd_set_target_mpi(${isvd_la} C) +isvd_set_target_blas(${isvd_la}) +target_link_libraries(isvd ${isvd_la}) + +# libisvd_gpu_none +file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/nogpu/*") +set_target(isvd_gpu_none "${files}") +isvd_set_target_mpi(isvd_gpu_none C) + +# libisvd_gpu +if(ISVD_USE_GPU) + file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/gpu/*") + set_target(isvd_gpu_magma "${files}") + isvd_set_target_mpi(isvd_gpu_magma C) + isvd_set_target_gpu(isvd_gpu_magma) + target_link_libraries(isvd isvd_gpu_magma) +else() + target_link_libraries(isvd isvd_gpu_none) +endif(ISVD_USE_GPU) diff --git a/src/libisvd.h b/src/lib/libisvd.h similarity index 93% rename from src/libisvd.h rename to src/lib/libisvd.h index f78447c..49a6c7c 100644 --- a/src/libisvd.h +++ b/src/lib/libisvd.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd.h +/// \file lib/libisvd.h /// \brief The main library header. /// /// \author Mu Yang <> diff --git a/src/libisvd/core.h b/src/lib/libisvd/core.h similarity index 91% rename from src/libisvd/core.h rename to src/lib/libisvd/core.h index 3dceb78..6342534 100644 --- a/src/libisvd/core.h +++ b/src/lib/libisvd/core.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core.h +/// \file lib/libisvd/core.h /// \brief The core header. /// /// \author Mu Yang <> diff --git a/src/libisvd/core/@x@_arg.h b/src/lib/libisvd/core/@x@_arg.h similarity index 98% rename from src/libisvd/core/@x@_arg.h rename to src/lib/libisvd/core/@x@_arg.h index 0124a68..b18be52 100644 --- a/src/libisvd/core/@x@_arg.h +++ b/src/lib/libisvd/core/@x@_arg.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/@x@_arg.h +/// \file lib/libisvd/core/@x@_arg.h /// \brief The @xname@ precision drivers argument utilities. /// /// \author Mu Yang <> diff --git a/src/libisvd/core/driver/@x@_isvd.c b/src/lib/libisvd/core/driver/@x@_isvd.c similarity index 93% rename from src/libisvd/core/driver/@x@_isvd.c rename to src/lib/libisvd/core/driver/@x@_isvd.c index 2751b1a..a4ea854 100644 --- a/src/libisvd/core/driver/@x@_isvd.c +++ b/src/lib/libisvd/core/driver/@x@_isvd.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/driver/@x@_isvd.c +/// \file lib/libisvd/core/driver/@x@_isvd.c /// \brief The iSVD driver (@xname@ precision). /// /// \author Mu Yang <> @@ -54,9 +54,9 @@ /// \param[in] ordera The storage ordering of 𝑨.
/// `'C'`: column-major ordering.
/// `'R'`: row-major ordering. -/// \param[in] a, lda The column/row-block 𝑨 (\f$m \times n_j\f$) and its leading dimension.
-/// \b dista = `'C'`: the size must be \f$m \times n_j\f$.
-/// \b dista = `'R'`: the size must be \f$m_j \times n\f$. +/// \param[in] a, lda The column/row-block 𝑨 (\f$m \times n^{(j)}\f$) and its leading dimension.
+/// \b dista = `'C'`: the size must be \f$m \times n^{(j)}\f$.
+/// \b dista = `'R'`: the size must be \f$m^{(j)} \times n\f$. /// \param[in] s The vector 𝝈 (\f$k \times 1\f$). /// \param[in] ut, ldut The matrix 𝑼 (row-major) and its leading dimension.
/// \b ut_root ≥ 0: the size must be \f$Pm_b \times k\f$, and \b ldut must be \f$l\f$.
@@ -187,33 +187,33 @@ void isvd_@x@Isvd( // ====================================================================================================================== // // Check stage arguments - if ( argc_s > 0 ) isvd_assert_ne(argv_s, nullptr); - if ( argc_o > 0 ) isvd_assert_ne(argv_o, nullptr); - if ( argc_i > 0 ) isvd_assert_ne(argv_i, nullptr); - if ( argc_p > 0 ) isvd_assert_ne(argv_p, nullptr); - if ( retc_s > 0 ) isvd_assert_ne(retv_s, nullptr); - if ( retc_o > 0 ) isvd_assert_ne(retv_o, nullptr); - if ( retc_i > 0 ) isvd_assert_ne(retv_i, nullptr); - if ( retc_p > 0 ) isvd_assert_ne(retv_p, nullptr); + if ( argc_s > 0 ) { isvd_assert_ne(argv_s, (void*)(nullptr)) }; + if ( argc_o > 0 ) { isvd_assert_ne(argv_o, (void*)(nullptr)) }; + if ( argc_i > 0 ) { isvd_assert_ne(argv_i, (void*)(nullptr)) }; + if ( argc_p > 0 ) { isvd_assert_ne(argv_p, (void*)(nullptr)) }; + if ( retc_s > 0 ) { isvd_assert_ne(retv_s, (void*)(nullptr)) }; + if ( retc_o > 0 ) { isvd_assert_ne(retv_o, (void*)(nullptr)) }; + if ( retc_i > 0 ) { isvd_assert_ne(retv_i, (void*)(nullptr)) }; + if ( retc_p > 0 ) { isvd_assert_ne(retv_p, (void*)(nullptr)) }; // ====================================================================================================================== // // Query stage arguments bool query = false; if ( argc_s < 0 ) { - fun_s(param, argv_s, argc_s, retv_s, retc_s, dista, ordera, NULL, 1, NULL, 1, seed, mpi_root); + fun_s(param, argv_s, argc_s, retv_s, retc_s, dista, ordera, nullptr, 1, nullptr, 1, seed, mpi_root); query = true; } if ( argc_o < 0 ) { - fun_o(param, argv_o, argc_o, retv_o, retc_o, NULL, 1); + fun_o(param, argv_o, argc_o, retv_o, retc_o, nullptr, 1); query = true; } if ( argc_i < 0 ) { - fun_i(param, argv_i, argc_i, retv_i, retc_i, NULL, 1, NULL, 1); + fun_i(param, argv_i, argc_i, retv_i, retc_i, nullptr, 1, nullptr, 1); query = true; } if ( argc_p < 0 ) { - fun_p(param, argv_p, argc_p, retv_p, retc_p, dista, ordera, NULL, 1, NULL, 1, NULL, NULL, 1, NULL, 1, ut_root, vt_root); + fun_p(param, argv_p, argc_p, retv_p, retc_p, dista, ordera, nullptr, 1, nullptr, 1, nullptr, nullptr, 1, nullptr, 1, ut_root, vt_root); query = true; } if ( query ) { diff --git a/src/libisvd/core/env.c b/src/lib/libisvd/core/env.c similarity index 93% rename from src/libisvd/core/env.c rename to src/lib/libisvd/core/env.c index 3a1172a..40101f2 100644 --- a/src/libisvd/core/env.c +++ b/src/lib/libisvd/core/env.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/env.c +/// \file lib/libisvd/core/env.c /// \brief The iSVD environment routines (CPU only). /// /// \author Mu Yang <> @@ -43,5 +43,5 @@ void isvd_printEnvironment_cpu( const isvd_MpiComm mpi_comm ) { omp_int_t omp_size = isvd_getOmpMaxSize(); printf("iSVD %s, %lu-bit isvd_int_t, %lu-bit pointer\n", ISVD_VERSION, sizeof(isvd_int_t) * 8, sizeof(void*) * 8); - printf("%d MPI nodes, %d OpenMP threads per node\n\n", mpi_size, omp_size); + printf("%d MPI processors, %d OpenMP threads per process\n\n", mpi_size, omp_size); } diff --git a/src/libisvd/core/param.c b/src/lib/libisvd/core/param.c similarity index 98% rename from src/libisvd/core/param.c rename to src/lib/libisvd/core/param.c index e58f70f..503e274 100644 --- a/src/libisvd/core/param.c +++ b/src/lib/libisvd/core/param.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/param.c +/// \file lib/libisvd/core/param.c /// \brief The parameter structure. /// /// \author Mu Yang <> diff --git a/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c b/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c similarity index 95% rename from src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c rename to src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c index 1636fa6..5294b52 100644 --- a/src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c +/// \file lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c /// \brief The Hierarchical Reduction Integration (@xname@ precision). /// /// \author Mu Yang <> @@ -41,8 +41,8 @@ void isvd_@x@IntegrateHierarchicalReduction( const isvd_int_t ldqt ) { - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } if ( argc < 0 ) return; // ====================================================================================================================== // diff --git a/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c b/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c similarity index 97% rename from src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c rename to src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c index 004b2ad..33f385f 100644 --- a/src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c +/// \file lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c /// \brief The Kolmogorov-Nagumo Integration (@xname@ precision). /// /// \author Mu Yang <> @@ -47,8 +47,8 @@ void isvd_@x@IntegrateKolmogorovNagumo( const isvd_int_t ldqt ) { - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } // ====================================================================================================================== // // Query arguments diff --git a/src/libisvd/core/stage/@x@_integrate_wen_yin.c b/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c similarity index 98% rename from src/libisvd/core/stage/@x@_integrate_wen_yin.c rename to src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c index f20fbaf..91b8630 100644 --- a/src/libisvd/core/stage/@x@_integrate_wen_yin.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_integrate_wen_yin.c +/// \file lib/libisvd/core/stage/@x@_integrate_wen_yin.c /// \brief The Wen-Yin Integration (@xname@ precision). /// /// \author Mu Yang <> @@ -61,8 +61,8 @@ void isvd_@x@IntegrateWenYin( const isvd_int_t ldqt ) { - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } // ====================================================================================================================== // // Query arguments diff --git a/src/libisvd/core/stage/@x@_orthogonalize_gramian.c b/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c similarity index 94% rename from src/libisvd/core/stage/@x@_orthogonalize_gramian.c rename to src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c index 343c8a6..7ad27c3 100644 --- a/src/libisvd/core/stage/@x@_orthogonalize_gramian.c +++ b/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_orthogonalize_gramian.c +/// \file lib/libisvd/core/stage/@x@_orthogonalize_gramian.c /// \brief The Gramian Orthogonalization (@xname@ precision). /// /// \author Mu Yang <> @@ -36,8 +36,8 @@ void isvd_@x@OrthogonalizeGramian( const isvd_int_t ldyst ) { - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } if ( argc < 0 ) return; // ====================================================================================================================== // diff --git a/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c b/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c similarity index 86% rename from src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c rename to src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c index 8be09dd..94ba2e5 100644 --- a/src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c +++ b/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c +/// \file lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c /// \brief The Tall-Skinny QR Orthogonalization (@xname@ precision). /// /// \author Mu Yang <> @@ -32,8 +32,8 @@ void isvd_@x@OrthogonalizeTallSkinnyQr( fprintf(stderr, "Tall-Skinny QR Orthogonalization is not implemented!\n"); - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } if ( argc < 0 ) return; ISVD_UNUSED(param); diff --git a/src/libisvd/core/stage/@x@_postprocess.h b/src/lib/libisvd/core/stage/@x@_postprocess.h similarity index 98% rename from src/libisvd/core/stage/@x@_postprocess.h rename to src/lib/libisvd/core/stage/@x@_postprocess.h index b655dea..b183364 100644 --- a/src/libisvd/core/stage/@x@_postprocess.h +++ b/src/lib/libisvd/core/stage/@x@_postprocess.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_postprocess.h +/// \file lib/libisvd/core/stage/@x@_postprocess.h /// \brief The Postprocessing utilities (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/core/stage/@x@_postprocess_gramian.c b/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c similarity index 96% rename from src/libisvd/core/stage/@x@_postprocess_gramian.c rename to src/lib/libisvd/core/stage/@x@_postprocess_gramian.c index 25a557c..4d9cb93 100644 --- a/src/libisvd/core/stage/@x@_postprocess_gramian.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_postprocess_gramian.c +/// \file lib/libisvd/core/stage/@x@_postprocess_gramian.c /// \brief The Gramian Postprocessing (@xname@ precision). /// /// \author Mu Yang <> @@ -27,9 +27,9 @@ /// \param[in] ordera The storage ordering of 𝑨.
/// `'C'`: column-major ordering.
/// `'R'`: row-major ordering. -/// \param[in] a, lda The column/row-block 𝑨 (\f$m \times n_j\f$) and its leading dimension.
-/// \b dista = `'C'`: the size must be \f$m \times n_j\f$.
-/// \b dista = `'R'`: the size must be \f$m_j \times n\f$. +/// \param[in] a, lda The column/row-block 𝑨 (\f$m \times n^{(j)}\f$) and its leading dimension.
+/// \b dista = `'C'`: the size must be \f$m \times n^{(j)}\f$.
+/// \b dista = `'R'`: the size must be \f$m^{(j)} \times n\f$. /// \param[in] qt, ldqt The row-block 𝑸 (\f$ m_b \times l \f$, row-major) and its leading dimension. /// \param[in] s The vector 𝝈 (\f$k \times 1\f$). /// \param[in] ut, ldut The matrix 𝑼 (row-major) and its leading dimension.
@@ -77,8 +77,8 @@ void isvd_@x@PostprocessGramian( const mpi_int_t vt_root ) { - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } if ( argc < 0 ) return; // ====================================================================================================================== // diff --git a/src/libisvd/core/stage/@x@_postprocess_symmetric.c b/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c similarity index 96% rename from src/libisvd/core/stage/@x@_postprocess_symmetric.c rename to src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c index b35214a..9e7ee34 100644 --- a/src/libisvd/core/stage/@x@_postprocess_symmetric.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_postprocess_symmetric.c +/// \file lib/libisvd/core/stage/@x@_postprocess_symmetric.c /// \brief The Symmetric Postprocessing (@xname@ precision). /// /// \author Mu Yang <> @@ -27,9 +27,9 @@ /// \param[in] ordera The storage ordering of 𝑨.
/// `'C'`: column-major ordering.
/// `'R'`: row-major ordering. -/// \param[in] a, lda The column/row-block 𝑨 (\f$m \times n_j\f$) and its leading dimension.
-/// \b dista = `'C'`: the size must be \f$m \times n_j\f$.
-/// \b dista = `'R'`: the size must be \f$m_j \times n\f$. +/// \param[in] a, lda The column/row-block 𝑨 (\f$m \times n^{(j)}\f$) and its leading dimension.
+/// \b dista = `'C'`: the size must be \f$m \times n^{(j)}\f$.
+/// \b dista = `'R'`: the size must be \f$m^{(j)} \times n\f$. /// \param[in] qt, ldqt The row-block 𝑸 (\f$ m_b \times l \f$, row-major) and its leading dimension. /// \param[in] s The vector 𝝈 (\f$k \times 1\f$). /// \param[in] ut, ldut The matrix 𝑼 (row-major) and its leading dimension.
@@ -77,8 +77,8 @@ void isvd_@x@PostprocessSymmetric( const mpi_int_t vt_root ) { - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } if ( argc < 0 ) return; ISVD_UNUSED(vt); diff --git a/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c b/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c similarity index 91% rename from src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c rename to src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c index f086974..d89240c 100644 --- a/src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c +/// \file lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c /// \brief The Tall-Skinny QR Postprocessing (@xname@ precision). /// /// \author Mu Yang <> @@ -45,8 +45,8 @@ void isvd_@x@PostprocessTallSkinnyQr( fprintf(stderr, "Tall-Skinny QR Postprocessing is not implemented!\n"); - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } if ( argc < 0 ) return; ISVD_UNUSED(param); diff --git a/src/libisvd/core/stage/@x@_sketch.h b/src/lib/libisvd/core/stage/@x@_sketch.h similarity index 98% rename from src/libisvd/core/stage/@x@_sketch.h rename to src/lib/libisvd/core/stage/@x@_sketch.h index 056e938..65a9727 100644 --- a/src/libisvd/core/stage/@x@_sketch.h +++ b/src/lib/libisvd/core/stage/@x@_sketch.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_sketch.h +/// \file lib/libisvd/core/stage/@x@_sketch.h /// \brief The Sketching utilities (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c b/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c similarity index 91% rename from src/libisvd/core/stage/@x@_sketch_gaussian_projection.c rename to src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c index ca779b4..047b317 100644 --- a/src/libisvd/core/stage/@x@_sketch_gaussian_projection.c +++ b/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/core/stage/@x@_sketch_gaussian_projection.c +/// \file lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c /// \brief The Gaussian Projection Sketching (@xname@ precision). /// /// \author Mu Yang <> @@ -26,9 +26,9 @@ /// \param[in] ordera The storage ordering of 𝑨.
/// `'C'`: column-major ordering.
/// `'R'`: row-major ordering. -/// \param[in] a, lda The column/row-block 𝑨 (\f$m \times n_j\f$) and its leading dimension.
-/// \b dista = `'C'`: the size must be \f$m \times n_j\f$.
-/// \b dista = `'R'`: the size must be \f$m_j \times n\f$. +/// \param[in] a, lda The column/row-block 𝑨 (\f$m \times n^{(j)}\f$) and its leading dimension.
+/// \b dista = `'C'`: the size must be \f$m \times n^{(j)}\f$.
+/// \b dista = `'R'`: the size must be \f$m^{(j)} \times n\f$. /// \param[in] yst, ldyst The row-block 𝖄 (\f$m_b \times Nl\f$, row-major) and its leading dimension.
/// \b dista = `'C'`: \b ldyst must be \f$Nl\f$.
/// \b dista = `'R'`: no condition. @@ -56,8 +56,8 @@ void isvd_@x@SketchGaussianProjection( const mpi_int_t mpi_root ) { - if ( argc > 0 ) isvd_assert_ne(argv, nullptr); - if ( retc > 0 ) isvd_assert_ne(retv, nullptr); + if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } + if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } if ( argc < 0 ) return; // ====================================================================================================================== // diff --git a/src/libisvd/def.h b/src/lib/libisvd/def.h similarity index 99% rename from src/libisvd/def.h rename to src/lib/libisvd/def.h index f57f009..63263c6 100644 --- a/src/libisvd/def.h +++ b/src/lib/libisvd/def.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/def.h +/// \file lib/libisvd/def.h /// \brief The definitions. /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu.h b/src/lib/libisvd/gpu.h similarity index 90% rename from src/libisvd/gpu.h rename to src/lib/libisvd/gpu.h index a60be0b..7e137a4 100644 --- a/src/libisvd/gpu.h +++ b/src/lib/libisvd/gpu.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu.h +/// \file lib/libisvd/gpu.h /// \brief The GPU header. /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu/def.h b/src/lib/libisvd/gpu/def.h similarity index 94% rename from src/libisvd/gpu/def.h rename to src/lib/libisvd/gpu/def.h index 48b33cd..e6efe21 100644 --- a/src/libisvd/gpu/def.h +++ b/src/lib/libisvd/gpu/def.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu/def.h +/// \file lib/libisvd/gpu/def.h /// \brief The GPU definitions. /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu/env.c b/src/lib/libisvd/gpu/env.c similarity index 98% rename from src/libisvd/gpu/env.c rename to src/lib/libisvd/gpu/env.c index 71d8337..687b1b0 100644 --- a/src/libisvd/gpu/env.c +++ b/src/lib/libisvd/gpu/env.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu/env.c +/// \file lib/libisvd/gpu/env.c /// \brief The iSVD environment routines (GPU only). /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu/stage/@x@_postprocess_gpu.h b/src/lib/libisvd/gpu/stage/@x@_postprocess_gpu.h similarity index 99% rename from src/libisvd/gpu/stage/@x@_postprocess_gpu.h rename to src/lib/libisvd/gpu/stage/@x@_postprocess_gpu.h index 27ae4d6..6edb0e9 100644 --- a/src/libisvd/gpu/stage/@x@_postprocess_gpu.h +++ b/src/lib/libisvd/gpu/stage/@x@_postprocess_gpu.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu/stage/@x@_postprocess_gpu.h +/// \file lib/libisvd/gpu/stage/@x@_postprocess_gpu.h /// \brief The GPU Postprocessing utilities (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c b/src/lib/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c similarity index 90% rename from src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c rename to src/lib/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c index 9fe3a5b..a8ff4b3 100644 --- a/src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c +++ b/src/lib/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c +/// \file lib/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.c /// \brief The GPU Gramian Postprocessing (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c b/src/lib/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c similarity index 90% rename from src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c rename to src/lib/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c index 8936f62..05fdd82 100644 --- a/src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c +++ b/src/lib/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c +/// \file lib/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.c /// \brief The GPU Symmetric Postprocessing (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c b/src/lib/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c similarity index 90% rename from src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c rename to src/lib/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c index 15a9388..82f68d7 100644 --- a/src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c +++ b/src/lib/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c +/// \file lib/libisvd/gpu/stage/@x@_postprocess_tall_skinny_qr_gpu.c /// \brief The GPU Tall-Skinny QR Postprocessing (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c b/src/lib/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c similarity index 90% rename from src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c rename to src/lib/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c index 82479a0..81b51ac 100644 --- a/src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c +++ b/src/lib/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c +/// \file lib/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.c /// \brief The GPU Gaussian Projection Sketching (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/gpu/stage/@x@_sketch_gpu.h b/src/lib/libisvd/gpu/stage/@x@_sketch_gpu.h similarity index 99% rename from src/libisvd/gpu/stage/@x@_sketch_gpu.h rename to src/lib/libisvd/gpu/stage/@x@_sketch_gpu.h index 6643f89..3863787 100644 --- a/src/libisvd/gpu/stage/@x@_sketch_gpu.h +++ b/src/lib/libisvd/gpu/stage/@x@_sketch_gpu.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/gpu/stage/@x@_sketch_gpu.h +/// \file lib/libisvd/gpu/stage/@x@_sketch_gpu.h /// \brief The GPU Sketching utilities (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/la.h b/src/lib/libisvd/la.h similarity index 90% rename from src/libisvd/la.h rename to src/lib/libisvd/la.h index 3aae050..6d0e7f9 100644 --- a/src/libisvd/la.h +++ b/src/lib/libisvd/la.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la.h +/// \file lib/libisvd/la.h /// \brief The linear algebra header. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/blas/dimm.c b/src/lib/libisvd/la/blas/dimm.c similarity index 97% rename from src/libisvd/la/blas/dimm.c rename to src/lib/libisvd/la/blas/dimm.c index 8c0fe05..abd171b 100644 --- a/src/libisvd/la/blas/dimm.c +++ b/src/lib/libisvd/la/blas/dimm.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/blas/dimm.c +/// \file lib/libisvd/la/blas/dimm.c /// \brief The BLAS-Like Dimm routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/blas/dism.c b/src/lib/libisvd/la/blas/dism.c similarity index 97% rename from src/libisvd/la/blas/dism.c rename to src/lib/libisvd/la/blas/dism.c index b9e49e3..63b9155 100644 --- a/src/libisvd/la/blas/dism.c +++ b/src/lib/libisvd/la/blas/dism.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/blas/dism.c +/// \file lib/libisvd/la/blas/dism.c /// \brief The BLAS-Like Dism routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/blas/gemmt.c b/src/lib/libisvd/la/blas/gemmt.c similarity index 98% rename from src/libisvd/la/blas/gemmt.c rename to src/lib/libisvd/la/blas/gemmt.c index 69dbb0c..5090093 100644 --- a/src/libisvd/la/blas/gemmt.c +++ b/src/lib/libisvd/la/blas/gemmt.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/blas/gemmt.c +/// \file lib/libisvd/la/blas/gemmt.c /// \brief The BLAS-Like Gemmt routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/blas/iamax.c b/src/lib/libisvd/la/blas/iamax.c similarity index 97% rename from src/libisvd/la/blas/iamax.c rename to src/lib/libisvd/la/blas/iamax.c index ddce590..c98e3d1 100644 --- a/src/libisvd/la/blas/iamax.c +++ b/src/lib/libisvd/la/blas/iamax.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/blas/iamax.c +/// \file lib/libisvd/la/blas/iamax.c /// \brief The BLAS-1 iAmax routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/blas/iamin.c b/src/lib/libisvd/la/blas/iamin.c similarity index 98% rename from src/libisvd/la/blas/iamin.c rename to src/lib/libisvd/la/blas/iamin.c index ddfed22..28b586f 100644 --- a/src/libisvd/la/blas/iamin.c +++ b/src/lib/libisvd/la/blas/iamin.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/blas/iamin.c +/// \file lib/libisvd/la/blas/iamin.c /// \brief The BLAS-1 iAmin routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/blas/omatcopy.c b/src/lib/libisvd/la/blas/omatcopy.c similarity index 98% rename from src/libisvd/la/blas/omatcopy.c rename to src/lib/libisvd/la/blas/omatcopy.c index aacab08..942871b 100644 --- a/src/libisvd/la/blas/omatcopy.c +++ b/src/lib/libisvd/la/blas/omatcopy.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/blas/omatcopy.c +/// \file lib/libisvd/la/blas/omatcopy.c /// \brief The BLAS-Like Omatcopy routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/def.h b/src/lib/libisvd/la/def.h similarity index 97% rename from src/libisvd/la/def.h rename to src/lib/libisvd/la/def.h index f37d804..3516ba2 100644 --- a/src/libisvd/la/def.h +++ b/src/lib/libisvd/la/def.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/def.h +/// \file lib/libisvd/la/def.h /// \brief The linear algebra definitions. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/lapack/geinv.c b/src/lib/libisvd/la/lapack/geinv.c similarity index 98% rename from src/libisvd/la/lapack/geinv.c rename to src/lib/libisvd/la/lapack/geinv.c index 36bed9b..3b7ea63 100644 --- a/src/libisvd/la/lapack/geinv.c +++ b/src/lib/libisvd/la/lapack/geinv.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/lapack/geinv.c +/// \file lib/libisvd/la/lapack/geinv.c /// \brief The LAPACK Getrf+Getri routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/lapack/gesvd.c b/src/lib/libisvd/la/lapack/gesvd.c similarity index 98% rename from src/libisvd/la/lapack/gesvd.c rename to src/lib/libisvd/la/lapack/gesvd.c index a36e63f..01eb7cc 100644 --- a/src/libisvd/la/lapack/gesvd.c +++ b/src/lib/libisvd/la/lapack/gesvd.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/lapack/gesvd.c +/// \file lib/libisvd/la/lapack/gesvd.c /// \brief The LAPACK Gesvd routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/lapack/lsame.c b/src/lib/libisvd/la/lapack/lsame.c similarity index 95% rename from src/libisvd/la/lapack/lsame.c rename to src/lib/libisvd/la/lapack/lsame.c index cb1fd72..dfd9b62 100644 --- a/src/libisvd/la/lapack/lsame.c +++ b/src/lib/libisvd/la/lapack/lsame.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/lapack/lsame.c +/// \file lib/libisvd/la/lapack/lsame.c /// \brief The LAPACK Lsame routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/lapack/syev.c b/src/lib/libisvd/la/lapack/syev.c similarity index 98% rename from src/libisvd/la/lapack/syev.c rename to src/lib/libisvd/la/lapack/syev.c index 15ded00..427be1a 100644 --- a/src/libisvd/la/lapack/syev.c +++ b/src/lib/libisvd/la/lapack/syev.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/lapack/syev.c +/// \file lib/libisvd/la/lapack/syev.c /// \brief The LAPACK Syev routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/util/memory.c b/src/lib/libisvd/la/util/memory.c similarity index 98% rename from src/libisvd/la/util/memory.c rename to src/lib/libisvd/la/util/memory.c index 8cf17f3..1354157 100644 --- a/src/libisvd/la/util/memory.c +++ b/src/lib/libisvd/la/util/memory.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/util/memory.c +/// \file lib/libisvd/la/util/memory.c /// \brief The memory utilities. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/util/omp.c b/src/lib/libisvd/la/util/omp.c similarity index 97% rename from src/libisvd/la/util/omp.c rename to src/lib/libisvd/la/util/omp.c index 6ff8096..0423710 100644 --- a/src/libisvd/la/util/omp.c +++ b/src/lib/libisvd/la/util/omp.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/util/omp.c +/// \file lib/libisvd/la/util/omp.c /// \brief The OpenMP utilities. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/vml/div.c b/src/lib/libisvd/la/vml/div.c similarity index 97% rename from src/libisvd/la/vml/div.c rename to src/lib/libisvd/la/vml/div.c index 5e08711..0699a0c 100644 --- a/src/libisvd/la/vml/div.c +++ b/src/lib/libisvd/la/vml/div.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/vml/div.c +/// \file lib/libisvd/la/vml/div.c /// \brief The VML Div routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/vml/mul.c b/src/lib/libisvd/la/vml/mul.c similarity index 97% rename from src/libisvd/la/vml/mul.c rename to src/lib/libisvd/la/vml/mul.c index 69cad7d..9e6efd8 100644 --- a/src/libisvd/la/vml/mul.c +++ b/src/lib/libisvd/la/vml/mul.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/vml/mul.c +/// \file lib/libisvd/la/vml/mul.c /// \brief The VML Mul routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/vml/sqrt.c b/src/lib/libisvd/la/vml/sqrt.c similarity index 96% rename from src/libisvd/la/vml/sqrt.c rename to src/lib/libisvd/la/vml/sqrt.c index ecb69c2..18a871f 100644 --- a/src/libisvd/la/vml/sqrt.c +++ b/src/lib/libisvd/la/vml/sqrt.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/vml/sqrt.c +/// \file lib/libisvd/la/vml/sqrt.c /// \brief The VML Sqrt routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/vml/sub.c b/src/lib/libisvd/la/vml/sub.c similarity index 97% rename from src/libisvd/la/vml/sub.c rename to src/lib/libisvd/la/vml/sub.c index 1e74fc1..9f77f4b 100644 --- a/src/libisvd/la/vml/sub.c +++ b/src/lib/libisvd/la/vml/sub.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/vml/sub.c +/// \file lib/libisvd/la/vml/sub.c /// \brief The VML Sub routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/vsl/@x@_rng_gaussian_driver.c b/src/lib/libisvd/la/vsl/@x@_rng_gaussian_driver.c similarity index 94% rename from src/libisvd/la/vsl/@x@_rng_gaussian_driver.c rename to src/lib/libisvd/la/vsl/@x@_rng_gaussian_driver.c index e440b67..eb648df 100644 --- a/src/libisvd/la/vsl/@x@_rng_gaussian_driver.c +++ b/src/lib/libisvd/la/vsl/@x@_rng_gaussian_driver.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/vsl/@x@_rng_gaussian_driver.c +/// \file lib/libisvd/la/vsl/@x@_rng_gaussian_driver.c /// \brief The VSL RngGaussian driver (@xname@ precision). /// /// \author Mu Yang <> diff --git a/src/libisvd/la/vsl/rng_gaussian.c b/src/lib/libisvd/la/vsl/rng_gaussian.c similarity index 96% rename from src/libisvd/la/vsl/rng_gaussian.c rename to src/lib/libisvd/la/vsl/rng_gaussian.c index 820d596..a04c7bc 100644 --- a/src/libisvd/la/vsl/rng_gaussian.c +++ b/src/lib/libisvd/la/vsl/rng_gaussian.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/vsl/rng_gaussian.c +/// \file lib/libisvd/la/vsl/rng_gaussian.c /// \brief The VSL RngGaussian routine. /// /// \author Mu Yang <> diff --git a/src/libisvd/la/vsl/service.c b/src/lib/libisvd/la/vsl/service.c similarity index 97% rename from src/libisvd/la/vsl/service.c rename to src/lib/libisvd/la/vsl/service.c index 000e627..445b0ba 100644 --- a/src/libisvd/la/vsl/service.c +++ b/src/lib/libisvd/la/vsl/service.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/la/vsl/service.c +/// \file lib/libisvd/la/vsl/service.c /// \brief The VSL service routines. /// /// \author Mu Yang <> diff --git a/src/libisvd/nogpu/@x@_stage.c b/src/lib/libisvd/nogpu/@x@_stage.c similarity index 98% rename from src/libisvd/nogpu/@x@_stage.c rename to src/lib/libisvd/nogpu/@x@_stage.c index bcc04a4..939b69c 100644 --- a/src/libisvd/nogpu/@x@_stage.c +++ b/src/lib/libisvd/nogpu/@x@_stage.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/nogpu/@x@_stage.c +/// \file lib/libisvd/nogpu/@x@_stage.c /// \brief The iSVD stages with NOGPU support. /// /// \author Mu Yang <> diff --git a/src/libisvd/nogpu/env.c b/src/lib/libisvd/nogpu/env.c similarity index 94% rename from src/libisvd/nogpu/env.c rename to src/lib/libisvd/nogpu/env.c index cbec278..0605c4d 100644 --- a/src/libisvd/nogpu/env.c +++ b/src/lib/libisvd/nogpu/env.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/nogpu/env.c +/// \file lib/libisvd/nogpu/env.c /// \brief The iSVD environment routines (NOGPU only). /// /// \author Mu Yang <> diff --git a/src/libisvd/util.h b/src/lib/libisvd/util.h similarity index 91% rename from src/libisvd/util.h rename to src/lib/libisvd/util.h index 8ad1edb..446e509 100644 --- a/src/libisvd/util.h +++ b/src/lib/libisvd/util.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/util.h +/// \file lib/libisvd/util.h /// \brief The utility header. /// /// \author Mu Yang <> diff --git a/src/libisvd/util/arg.h b/src/lib/libisvd/util/arg.h similarity index 97% rename from src/libisvd/util/arg.h rename to src/lib/libisvd/util/arg.h index 5eae2a7..54b6aea 100644 --- a/src/libisvd/util/arg.h +++ b/src/lib/libisvd/util/arg.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/util/arg.h +/// \file lib/libisvd/util/arg.h /// \brief The argument utilities. /// /// \author Mu Yang <> diff --git a/src/libisvd/util/function.h b/src/lib/libisvd/util/function.h similarity index 95% rename from src/libisvd/util/function.h rename to src/lib/libisvd/util/function.h index becaa0e..cd1ef41 100644 --- a/src/libisvd/util/function.h +++ b/src/lib/libisvd/util/function.h @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/util/function.h +/// \file lib/libisvd/util/function.h /// \brief Some useful functions. /// /// \author Mu Yang <> diff --git a/src/libisvd/util/io.c b/src/lib/libisvd/util/io.c similarity index 96% rename from src/libisvd/util/io.c rename to src/lib/libisvd/util/io.c index d405f5b..6b50b31 100644 --- a/src/libisvd/util/io.c +++ b/src/lib/libisvd/util/io.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/util/io.c +/// \file lib/libisvd/util/io.c /// \brief The I/O utilities. /// /// \author Mu Yang <> diff --git a/src/libisvd/util/memory.c b/src/lib/libisvd/util/memory.c similarity index 73% rename from src/libisvd/util/memory.c rename to src/lib/libisvd/util/memory.c index 3f19d97..f4e62ec 100644 --- a/src/libisvd/util/memory.c +++ b/src/lib/libisvd/util/memory.c @@ -1,11 +1,11 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/util/memory.c +/// \file lib/libisvd/util/memory.c /// \brief The memory utilities. /// /// \author Mu Yang <> /// \copyright MIT License /// -/// \note Implement in \ref src/libisvd/la/util/memory.c +/// \note Implement in \ref lib/libisvd/la/util/memory.c /// #include \ No newline at end of file diff --git a/src/libisvd/util/mpi.c b/src/lib/libisvd/util/mpi.c similarity index 97% rename from src/libisvd/util/mpi.c rename to src/lib/libisvd/util/mpi.c index b6e615a..0c597fc 100644 --- a/src/libisvd/util/mpi.c +++ b/src/lib/libisvd/util/mpi.c @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/util/mpi.c +/// \file lib/libisvd/util/mpi.c /// \brief The MPI utilities. /// /// \author Mu Yang <> diff --git a/src/libisvd/util/omp.c b/src/lib/libisvd/util/omp.c similarity index 74% rename from src/libisvd/util/omp.c rename to src/lib/libisvd/util/omp.c index bd01dd1..0a6a13b 100644 --- a/src/libisvd/util/omp.c +++ b/src/lib/libisvd/util/omp.c @@ -1,11 +1,11 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file src/libisvd/util/omp.c +/// \file lib/libisvd/util/omp.c /// \brief The OpenMP utilities. /// /// \author Mu Yang <> /// \copyright MIT License /// -/// \note Implement in \ref src/libisvd/la/util/omp.c +/// \note Implement in \ref lib/libisvd/la/util/omp.c /// #include \ No newline at end of file From 21200c73dec228ad92b5dccede102627e168501f Mon Sep 17 00:00:00 2001 From: Mu Yang Date: Wed, 13 Sep 2017 20:06:51 +0800 Subject: [PATCH 6/8] Update folder structure. Update tutorial. --- .../@x@_integrate_hierarchical_reduction.cxx | 6 +- .../stage/@x@_integrate_kolmogorov_nagumo.cxx | 4 +- .../core/stage/@x@_integrate_wen_yin.cxx | 4 +- .../core/stage/@x@_orthogonalize_gramian.cxx | 6 +- .../core/stage/@x@_postprocess_gramian.cxx | 22 ++--- .../core/stage/@x@_postprocess_symmetric.cxx | 24 +++--- .../stage/@x@_sketch_gaussian_projection.cxx | 10 +-- .../gpu/stage/@x@_postprocess_gramian_gpu.cxx | 22 ++--- .../stage/@x@_postprocess_symmetric_gpu.cxx | 24 +++--- .../@x@_sketch_gaussian_projection_gpu.cxx | 10 +-- cpplint/CMakeLists.txt | 6 +- src/lib/libisvd/core/@x@_arg.h | 16 ++-- src/lib/libisvd/core/driver/@x@_isvd.c | 84 +++++++++---------- .../@x@_integrate_hierarchical_reduction.c | 6 +- .../stage/@x@_integrate_kolmogorov_nagumo.c | 4 +- .../core/stage/@x@_integrate_wen_yin.c | 4 +- .../core/stage/@x@_orthogonalize_gramian.c | 6 +- .../stage/@x@_orthogonalize_tall_skinny_qr.c | 4 +- .../core/stage/@x@_postprocess_gramian.c | 14 ++-- .../core/stage/@x@_postprocess_symmetric.c | 10 +-- .../stage/@x@_postprocess_tall_skinny_qr.c | 4 +- .../stage/@x@_sketch_gaussian_projection.c | 8 +- src/lib/libisvd/def.h | 2 +- src/lib/libisvd/la/blas/dimm.c | 2 +- src/lib/libisvd/la/blas/dism.c | 2 +- src/lib/libisvd/la/blas/omatcopy.c | 2 +- src/lib/libisvd/la/lapack/geinv.c | 8 +- src/lib/libisvd/la/lapack/gesvd.c | 4 +- src/lib/libisvd/la/lapack/syev.c | 4 +- src/lib/libisvd/util/arg.h | 4 +- 30 files changed, 163 insertions(+), 163 deletions(-) diff --git a/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx b/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx index 5a4c58a..8f6d775 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx @@ -26,7 +26,7 @@ TEST(@XStr@_HierarchicalReductionIntegration, Test) { // Read Qs file = fopen(QS_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -47,7 +47,7 @@ TEST(@XStr@_HierarchicalReductionIntegration, Test) { // Read Qbar file = fopen(Q_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -92,7 +92,7 @@ TEST(@XStr@_HierarchicalReductionIntegration, Test) { isvd_int_t ldqt = l; // Run stage - isvd_@x@IntegrateHierarchicalReduction(param, nullptr, 0, nullptr, 0, qst, ldqst, qt, ldqt); + isvd_@x@IntegrateHierarchicalReduction(param, NULL, 0, NULL, 0, qst, ldqst, qt, ldqt); // Gather results isvd_val_t *qt_ = isvd_@x@malloc(l * Pmb); diff --git a/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx b/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx index 3faa507..a898436 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx @@ -31,7 +31,7 @@ TEST(@XStr@_KolmogorovNagumoIntegration, Test) { // Read Qs file = fopen(QS_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -52,7 +52,7 @@ TEST(@XStr@_KolmogorovNagumoIntegration, Test) { // Read Qbar file = fopen(Q_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); diff --git a/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx b/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx index 919610b..70acfe7 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx @@ -31,7 +31,7 @@ TEST(@XStr@_WenYinIntegration, Test) { // Read Qs file = fopen(QS_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -52,7 +52,7 @@ TEST(@XStr@_WenYinIntegration, Test) { // Read Qbar file = fopen(Q_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); diff --git a/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx b/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx index 1047c95..bf37456 100644 --- a/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx +++ b/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx @@ -25,7 +25,7 @@ TEST(@XStr@_GramianOrthogonalization, Test) { // Read Ys file = fopen(YS_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -46,7 +46,7 @@ TEST(@XStr@_GramianOrthogonalization, Test) { // Read Qs file = fopen(QS_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -90,7 +90,7 @@ TEST(@XStr@_GramianOrthogonalization, Test) { isvd_@x@Omatcopy('N', Nl, mj, 1.0, yst0 + param.rowidxbegin * ldyst0, ldyst0, yst, ldyst); // Run - isvd_@x@OrthogonalizeGramian(param, nullptr, 0, nullptr, 0, yst, ldyst); + isvd_@x@OrthogonalizeGramian(param, NULL, 0, NULL, 0, yst, ldyst); // Gather results isvd_val_t *qst_ = isvd_@x@malloc(Pmb * ldyst); diff --git a/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx b/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx index 6d5d55f..c352f73 100644 --- a/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx +++ b/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx @@ -34,14 +34,14 @@ static void test( char dista, char ordera, const JobUV jobuv ) { MM_typecode matcode; // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); ASSERT_NE(dista_, '\0'); ASSERT_NE(ordera_, '\0'); // Read A file = fopen(A_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -72,7 +72,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read Q file = fopen(Q_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -97,7 +97,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read S file = fopen(S_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -120,7 +120,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read U file = fopen(U_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -146,7 +146,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read V file = fopen(V_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -216,7 +216,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { case GatherUV: { // Run stage - isvd_@x@PostprocessGramian(param, nullptr, 0, nullptr, 0, dista_, ordera_, + isvd_@x@PostprocessGramian(param, NULL, 0, NULL, 0, dista_, ordera_, a, lda, qt, ldqt, s, ut_, ldut_, vt_, ldvt_, mpi_root, mpi_root); break; @@ -232,7 +232,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { isvd_int_t ldvt = l; // Run stage - isvd_@x@PostprocessGramian(param, nullptr, 0, nullptr, 0, dista_, ordera_, + isvd_@x@PostprocessGramian(param, NULL, 0, NULL, 0, dista_, ordera_, a, lda, qt, ldqt, s, ut, ldut, vt, ldvt, -1, -1); // Gather results @@ -249,8 +249,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { case NoUV: { // Run stage - isvd_@x@PostprocessGramian(param, nullptr, 0, nullptr, 0, dista_, ordera_, - a, lda, qt, ldqt, s, nullptr, 0, nullptr, 0, -2, -2); + isvd_@x@PostprocessGramian(param, NULL, 0, NULL, 0, dista_, ordera_, + a, lda, qt, ldqt, s, NULL, 0, NULL, 0, -2, -2); break; } diff --git a/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx b/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx index 2104ec2..6855eda 100644 --- a/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx +++ b/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx @@ -33,14 +33,14 @@ static void test( char dista, char ordera, const JobUV jobuv ) { MM_typecode matcode; // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); ASSERT_NE(dista_, '\0'); ASSERT_NE(ordera_, '\0'); // Read A file = fopen(A_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -71,7 +71,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read Q file = fopen(Q_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -96,7 +96,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read S file = fopen(S_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -119,7 +119,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read U file = fopen(U_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -186,8 +186,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { case GatherUV: { // Run stage - isvd_@x@PostprocessSymmetric(param, nullptr, 0, nullptr, 0, dista_, ordera_, - a, lda, qt, ldqt, s, ut_, ldut_, nullptr, 0, mpi_root, -2); + isvd_@x@PostprocessSymmetric(param, NULL, 0, NULL, 0, dista_, ordera_, + a, lda, qt, ldqt, s, ut_, ldut_, NULL, 0, mpi_root, -2); break; } @@ -199,8 +199,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { isvd_int_t ldut = l; // Run stage - isvd_@x@PostprocessSymmetric(param, nullptr, 0, nullptr, 0, dista_, ordera_, - a, lda, qt, ldqt, s, ut, ldut, nullptr, 0, -1, -2); + isvd_@x@PostprocessSymmetric(param, NULL, 0, NULL, 0, dista_, ordera_, + a, lda, qt, ldqt, s, ut, ldut, NULL, 0, -1, -2); // Gather results MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, ut_, mb*ldut, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); @@ -214,8 +214,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { case NoUV: { // Run stage - isvd_@x@PostprocessSymmetric(param, nullptr, 0, nullptr, 0, dista_, ordera_, - a, lda, qt, ldqt, s, nullptr, 0, nullptr, 0, -2, -2); + isvd_@x@PostprocessSymmetric(param, NULL, 0, NULL, 0, dista_, ordera_, + a, lda, qt, ldqt, s, NULL, 0, NULL, 0, -2, -2); break; } diff --git a/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx b/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx index 02d11e7..c552ffc 100644 --- a/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx +++ b/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx @@ -25,14 +25,14 @@ static void test( char dista, char ordera ) { MM_typecode matcode; // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); ASSERT_NE(dista_, '\0'); ASSERT_NE(ordera_, '\0'); // Read A file = fopen(A_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -63,7 +63,7 @@ static void test( char dista, char ordera ) { // Read Ys file = fopen(YS_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -119,7 +119,7 @@ static void test( char dista, char ordera ) { isvd_int_t ldyst = Nl; // Run stage - isvd_@x@SketchGaussianProjection(param, nullptr, 0, nullptr, 0, dista_, ordera_, a, lda, yst, ldyst, seed, mpi_root); + isvd_@x@SketchGaussianProjection(param, NULL, 0, NULL, 0, dista_, ordera_, a, lda, yst, ldyst, seed, mpi_root); #if defined(ISVD_USE_MKL) // Gather results diff --git a/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx index c2d1831..7371fc7 100644 --- a/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx @@ -34,14 +34,14 @@ static void test( char dista, char ordera, const JobUV jobuv ) { MM_typecode matcode; // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); ASSERT_NE(dista_, '\0'); ASSERT_NE(ordera_, '\0'); // Read A file = fopen(A_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -72,7 +72,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read Q file = fopen(Q_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -97,7 +97,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read S file = fopen(S_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -120,7 +120,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read U file = fopen(U_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -146,7 +146,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read V file = fopen(V_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -216,7 +216,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { case GatherUV: { // Run stage - isvd_@x@PostprocessGramian_gpu(param, nullptr, 0, nullptr, 0, dista_, ordera_, + isvd_@x@PostprocessGramian_gpu(param, NULL, 0, NULL, 0, dista_, ordera_, a, lda, qt, ldqt, s, ut_, ldut_, vt_, ldvt_, mpi_root, mpi_root); break; @@ -232,7 +232,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { isvd_int_t ldvt = l; // Run stage - isvd_@x@PostprocessGramian_gpu(param, nullptr, 0, nullptr, 0, dista_, ordera_, + isvd_@x@PostprocessGramian_gpu(param, NULL, 0, NULL, 0, dista_, ordera_, a, lda, qt, ldqt, s, ut, ldut, vt, ldvt, -1, -1); // Gather results @@ -249,8 +249,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { case NoUV: { // Run stage - isvd_@x@PostprocessGramian_gpu(param, nullptr, 0, nullptr, 0, dista_, ordera_, - a, lda, qt, ldqt, s, nullptr, 0, nullptr, 0, -2, -2); + isvd_@x@PostprocessGramian_gpu(param, NULL, 0, NULL, 0, dista_, ordera_, + a, lda, qt, ldqt, s, NULL, 0, NULL, 0, -2, -2); break; } diff --git a/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx index 150e763..a4d0757 100644 --- a/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx @@ -33,14 +33,14 @@ static void test( char dista, char ordera, const JobUV jobuv ) { MM_typecode matcode; // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); ASSERT_NE(dista_, '\0'); ASSERT_NE(ordera_, '\0'); // Read A file = fopen(A_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -71,7 +71,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read Q file = fopen(Q_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -96,7 +96,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read S file = fopen(S_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -119,7 +119,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { // Read U file = fopen(U_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -186,8 +186,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { case GatherUV: { // Run stage - isvd_@x@PostprocessSymmetric_gpu(param, nullptr, 0, nullptr, 0, dista_, ordera_, - a, lda, qt, ldqt, s, ut_, ldut_, nullptr, 0, mpi_root, -2); + isvd_@x@PostprocessSymmetric_gpu(param, NULL, 0, NULL, 0, dista_, ordera_, + a, lda, qt, ldqt, s, ut_, ldut_, NULL, 0, mpi_root, -2); break; } @@ -199,8 +199,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { isvd_int_t ldut = l; // Run stage - isvd_@x@PostprocessSymmetric_gpu(param, nullptr, 0, nullptr, 0, dista_, ordera_, - a, lda, qt, ldqt, s, ut, ldut, nullptr, 0, -1, -2); + isvd_@x@PostprocessSymmetric_gpu(param, NULL, 0, NULL, 0, dista_, ordera_, + a, lda, qt, ldqt, s, ut, ldut, NULL, 0, -1, -2); // Gather results MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, ut_, mb*ldut, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); @@ -214,8 +214,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { case NoUV: { // Run stage - isvd_@x@PostprocessSymmetric_gpu(param, nullptr, 0, nullptr, 0, dista_, ordera_, - a, lda, qt, ldqt, s, nullptr, 0, nullptr, 0, -2, -2); + isvd_@x@PostprocessSymmetric_gpu(param, NULL, 0, NULL, 0, dista_, ordera_, + a, lda, qt, ldqt, s, NULL, 0, NULL, 0, -2, -2); break; } diff --git a/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx index bae5068..213694c 100644 --- a/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx @@ -25,14 +25,14 @@ static void test( char dista, char ordera ) { MM_typecode matcode; // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); ASSERT_NE(dista_, '\0'); ASSERT_NE(ordera_, '\0'); // Read A file = fopen(A_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -63,7 +63,7 @@ static void test( char dista, char ordera ) { // Read Ys file = fopen(YS_PATH, "r"); - ASSERT_NE(file, (void*)(nullptr)); + ASSERT_NE(file, nullptr); ASSERT_EQ(mm_read_banner(file, &matcode), 0); EXPECT_TRUE(mm_is_array(matcode)) << mm_typecode_to_str(matcode); EXPECT_TRUE(mm_is_real(matcode)) << mm_typecode_to_str(matcode); @@ -119,7 +119,7 @@ static void test( char dista, char ordera ) { isvd_int_t ldyst = Nl; // Run stage - isvd_@x@SketchGaussianProjection_gpu(param, nullptr, 0, nullptr, 0, dista_, ordera_, a, lda, yst, ldyst, seed, mpi_root); + isvd_@x@SketchGaussianProjection_gpu(param, NULL, 0, NULL, 0, dista_, ordera_, a, lda, yst, ldyst, seed, mpi_root); #if defined(ISVD_USE_MKL) // Gather results diff --git a/cpplint/CMakeLists.txt b/cpplint/CMakeLists.txt index 4863902..54fed26 100644 --- a/cpplint/CMakeLists.txt +++ b/cpplint/CMakeLists.txt @@ -9,8 +9,8 @@ function(SET_CPPLINT_TARGET path) string(REPLACE "/" "_" target ${path}) add_custom_target( cpplint_${target} - COMMAND ${CMAKE_CPPLINT} --recursive --root=${PROJECT_CONFIG_DIR}/${path} ${ARGN} ${path} - WORKING_DIRECTORY ${PROJECT_CONFIG_DIR} + COMMAND ${CMAKE_CPPLINT} --recursive --root=${PROJECT_BINARY_DIR}/${path} ${ARGN} ${path} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Run cpplint for ${path}" ) add_dependencies(cpplint cpplint_${target}) @@ -25,4 +25,4 @@ add_custom_target( ) set_cpplint_target(include/c --linelength=128 --filter=-build/include,-build/include_order,-readability/casting,-whitespace/blank_line,-whitespace/braces,-whitespace/parens) -set_cpplint_target(src --linelength=128 --filter=-build/include,-build/include_order,-build/include_what_you_use,-readability/casting,-whitespace/blank_line,-whitespace/braces,-whitespace/parens) +set_cpplint_target(lib --linelength=128 --filter=-build/include,-build/include_order,-build/include_what_you_use,-readability/casting,-whitespace/blank_line,-whitespace/braces,-whitespace/parens) diff --git a/src/lib/libisvd/core/@x@_arg.h b/src/lib/libisvd/core/@x@_arg.h index b18be52..53a143c 100644 --- a/src/lib/libisvd/core/@x@_arg.h +++ b/src/lib/libisvd/core/@x@_arg.h @@ -24,14 +24,14 @@ static inline isvd_fun_t isvd_arg2@x@AlgS( const char *arg ) { if ( !strcmp(arg, "GP") ) return (isvd_fun_t) isvd_@x@SketchGaussianProjection; if ( !strcmp(arg, "GP_gpu") ) return (isvd_fun_t) isvd_@x@SketchGaussianProjection_gpu; fprintf(stderr, "Unknown sketching abbreviation \"%s\"!\n", arg); - return nullptr; + return NULL; } static inline isvd_fun_t isvd_arg2@x@AlgO( const char *arg ) { if ( !strcmp(arg, "TS") ) return (isvd_fun_t) isvd_@x@OrthogonalizeTallSkinnyQr; if ( !strcmp(arg, "GR") ) return (isvd_fun_t) isvd_@x@OrthogonalizeGramian; fprintf(stderr, "Unknown orthogonalization abbreviation \"%s\"!\n", arg); - return nullptr; + return NULL; } static inline isvd_fun_t isvd_arg2@x@AlgI( const char *arg ) { @@ -39,7 +39,7 @@ static inline isvd_fun_t isvd_arg2@x@AlgI( const char *arg ) { if ( !strcmp(arg, "WY") ) return (isvd_fun_t) isvd_@x@IntegrateWenYin; if ( !strcmp(arg, "HR") ) return (isvd_fun_t) isvd_@x@IntegrateHierarchicalReduction; fprintf(stderr, "Unknown integration abbreviation \"%s\"!\n", arg); - return nullptr; + return NULL; } static inline isvd_fun_t isvd_arg2@x@AlgP( const char *arg ) { @@ -50,21 +50,21 @@ static inline isvd_fun_t isvd_arg2@x@AlgP( const char *arg ) { if ( !strcmp(arg, "GR_gpu") ) return (isvd_fun_t) isvd_@x@PostprocessGramian_gpu; if ( !strcmp(arg, "SY_gpu") ) return (isvd_fun_t) isvd_@x@PostprocessSymmetric_gpu; fprintf(stderr, "Unknown postprocess abbreviation \"%s\"!\n", arg); - return nullptr; + return NULL; } static inline const char* isvd_arg2@x@AlgNameS( const char *arg ) { if ( !strcmp(arg, "GP") ) return "@XName@ Precision Gaussian Projection Sketching"; if ( !strcmp(arg, "GP_gpu") ) return "@XName@ Precision GPU Gaussian Projection Sketching"; fprintf(stderr, "Unknown sketching abbreviation \"%s\"!\n", arg); - return nullptr; + return NULL; } static inline const char* isvd_arg2@x@AlgNameO( const char *arg ) { if ( !strcmp(arg, "TS") ) return "@XName@ Precision Tall-Skinny QR Orthogonalization"; if ( !strcmp(arg, "GR") ) return "@XName@ Precision Gramian Orthogonalization"; fprintf(stderr, "Unknown orthogonalization abbreviation \"%s\"!\n", arg); - return nullptr; + return NULL; } static inline const char* isvd_arg2@x@AlgNameI( const char *arg ) { @@ -72,7 +72,7 @@ static inline const char* isvd_arg2@x@AlgNameI( const char *arg ) { if ( !strcmp(arg, "WY") ) return "@XName@ Precision Wen-Yin Integration"; if ( !strcmp(arg, "HR") ) return "@XName@ Precision Hierarchical Reduction Integration"; fprintf(stderr, "Unknown integration abbreviation \"%s\"!\n", arg); - return nullptr; + return NULL; } static inline const char* isvd_arg2@x@AlgNameP( const char *arg ) { @@ -83,7 +83,7 @@ static inline const char* isvd_arg2@x@AlgNameP( const char *arg ) { if ( !strcmp(arg, "GR_gpu") ) return "@XName@ Precision GPU Gramian Postprocessing"; if ( !strcmp(arg, "SY_gpu") ) return "@XName@ Precision GPU Symmetric Postprocessing"; fprintf(stderr, "Unknown postprocess abbreviation \"%s\"!\n", arg); - return nullptr; + return NULL; } #if defined(__cplusplus) diff --git a/src/lib/libisvd/core/driver/@x@_isvd.c b/src/lib/libisvd/core/driver/@x@_isvd.c index a4ea854..82bce7e 100644 --- a/src/lib/libisvd/core/driver/@x@_isvd.c +++ b/src/lib/libisvd/core/driver/@x@_isvd.c @@ -141,10 +141,10 @@ void isvd_@x@Isvd( const char *opts_i[] = {"KN", "WY", "HR"}; const char *opts_p[] = {"TS", "GR", "SY", "TS_gpu", "GR_gpu", "SY_gpu"}; - const char *alg_s_ = isvd_arg2str("ALG_S", alg_s, opts_s, nullptr, lenof(opts_s)); - const char *alg_o_ = isvd_arg2str("ALG_O", alg_o, opts_o, nullptr, lenof(opts_o)); - const char *alg_i_ = isvd_arg2str("ALG_I", alg_i, opts_i, nullptr, lenof(opts_i)); - const char *alg_p_ = isvd_arg2str("ALG_P", alg_p, opts_p, nullptr, lenof(opts_p)); + const char *alg_s_ = isvd_arg2str("ALG_S", alg_s, opts_s, NULL, lenof(opts_s)); + const char *alg_o_ = isvd_arg2str("ALG_O", alg_o, opts_o, NULL, lenof(opts_o)); + const char *alg_i_ = isvd_arg2str("ALG_I", alg_i, opts_i, NULL, lenof(opts_i)); + const char *alg_p_ = isvd_arg2str("ALG_P", alg_p, opts_p, NULL, lenof(opts_p)); if ( !alg_s_ || !alg_o_ || !alg_i_ || !alg_p_ ) return; isvd_fun_t fun_s = isvd_arg2@x@AlgS(alg_s_); @@ -164,56 +164,56 @@ void isvd_@x@Isvd( // ====================================================================================================================== // // Gets arguments and return values of stages - const @xtype@ *argv_s = (argv != nullptr) ? argv[0] : nullptr; - const @xtype@ *argv_o = (argv != nullptr) ? argv[1] : nullptr; - const @xtype@ *argv_i = (argv != nullptr) ? argv[2] : nullptr; - const @xtype@ *argv_p = (argv != nullptr) ? argv[3] : nullptr; + const @xtype@ *argv_s = (argv != NULL) ? argv[0] : NULL; + const @xtype@ *argv_o = (argv != NULL) ? argv[1] : NULL; + const @xtype@ *argv_i = (argv != NULL) ? argv[2] : NULL; + const @xtype@ *argv_p = (argv != NULL) ? argv[3] : NULL; - const isvd_int_t argc_s = (argv != nullptr) ? argc[0] : 0; - const isvd_int_t argc_o = (argv != nullptr) ? argc[1] : 0; - const isvd_int_t argc_i = (argv != nullptr) ? argc[2] : 0; - const isvd_int_t argc_p = (argv != nullptr) ? argc[3] : 0; + const isvd_int_t argc_s = (argv != NULL) ? argc[0] : 0; + const isvd_int_t argc_o = (argv != NULL) ? argc[1] : 0; + const isvd_int_t argc_i = (argv != NULL) ? argc[2] : 0; + const isvd_int_t argc_p = (argv != NULL) ? argc[3] : 0; - @xtype@ *retv_s = (retv != nullptr) ? retv[0] : nullptr; - @xtype@ *retv_o = (retv != nullptr) ? retv[1] : nullptr; - @xtype@ *retv_i = (retv != nullptr) ? retv[2] : nullptr; - @xtype@ *retv_p = (retv != nullptr) ? retv[3] : nullptr; + @xtype@ *retv_s = (retv != NULL) ? retv[0] : NULL; + @xtype@ *retv_o = (retv != NULL) ? retv[1] : NULL; + @xtype@ *retv_i = (retv != NULL) ? retv[2] : NULL; + @xtype@ *retv_p = (retv != NULL) ? retv[3] : NULL; - const isvd_int_t retc_s = (retv != nullptr) ? retc[0] : 0; - const isvd_int_t retc_o = (retv != nullptr) ? retc[1] : 0; - const isvd_int_t retc_i = (retv != nullptr) ? retc[2] : 0; - const isvd_int_t retc_p = (retv != nullptr) ? retc[3] : 0; + const isvd_int_t retc_s = (retv != NULL) ? retc[0] : 0; + const isvd_int_t retc_o = (retv != NULL) ? retc[1] : 0; + const isvd_int_t retc_i = (retv != NULL) ? retc[2] : 0; + const isvd_int_t retc_p = (retv != NULL) ? retc[3] : 0; // ====================================================================================================================== // // Check stage arguments - if ( argc_s > 0 ) { isvd_assert_ne(argv_s, (void*)(nullptr)) }; - if ( argc_o > 0 ) { isvd_assert_ne(argv_o, (void*)(nullptr)) }; - if ( argc_i > 0 ) { isvd_assert_ne(argv_i, (void*)(nullptr)) }; - if ( argc_p > 0 ) { isvd_assert_ne(argv_p, (void*)(nullptr)) }; - if ( retc_s > 0 ) { isvd_assert_ne(retv_s, (void*)(nullptr)) }; - if ( retc_o > 0 ) { isvd_assert_ne(retv_o, (void*)(nullptr)) }; - if ( retc_i > 0 ) { isvd_assert_ne(retv_i, (void*)(nullptr)) }; - if ( retc_p > 0 ) { isvd_assert_ne(retv_p, (void*)(nullptr)) }; + if ( argc_s > 0 ) { isvd_assert_ne(argv_s, nullptr); } + if ( argc_o > 0 ) { isvd_assert_ne(argv_o, nullptr); } + if ( argc_i > 0 ) { isvd_assert_ne(argv_i, nullptr); } + if ( argc_p > 0 ) { isvd_assert_ne(argv_p, nullptr); } + if ( retc_s > 0 ) { isvd_assert_ne(retv_s, nullptr); } + if ( retc_o > 0 ) { isvd_assert_ne(retv_o, nullptr); } + if ( retc_i > 0 ) { isvd_assert_ne(retv_i, nullptr); } + if ( retc_p > 0 ) { isvd_assert_ne(retv_p, nullptr); } // ====================================================================================================================== // // Query stage arguments bool query = false; if ( argc_s < 0 ) { - fun_s(param, argv_s, argc_s, retv_s, retc_s, dista, ordera, nullptr, 1, nullptr, 1, seed, mpi_root); + fun_s(param, argv_s, argc_s, retv_s, retc_s, dista, ordera, NULL, 1, NULL, 1, seed, mpi_root); query = true; } if ( argc_o < 0 ) { - fun_o(param, argv_o, argc_o, retv_o, retc_o, nullptr, 1); + fun_o(param, argv_o, argc_o, retv_o, retc_o, NULL, 1); query = true; } if ( argc_i < 0 ) { - fun_i(param, argv_i, argc_i, retv_i, retc_i, nullptr, 1, nullptr, 1); + fun_i(param, argv_i, argc_i, retv_i, retc_i, NULL, 1, NULL, 1); query = true; } if ( argc_p < 0 ) { - fun_p(param, argv_p, argc_p, retv_p, retc_p, dista, ordera, nullptr, 1, nullptr, 1, nullptr, nullptr, 1, nullptr, 1, ut_root, vt_root); + fun_p(param, argv_p, argc_p, retv_p, retc_p, dista, ordera, NULL, 1, NULL, 1, NULL, NULL, 1, NULL, 1, ut_root, vt_root); query = true; } if ( query ) { @@ -223,7 +223,7 @@ void isvd_@x@Isvd( // ====================================================================================================================== // // Print arguments - if ( stream != nullptr && mpi_rank == mpi_root ) { + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameS(alg_s_)); fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameO(alg_o_)); fprintf(stream, "Using %s\n", isvd_arg2@x@AlgNameI(alg_i_)); @@ -243,33 +243,33 @@ void isvd_@x@Isvd( // ====================================================================================================================== // // Run - if ( stream != nullptr && mpi_rank == mpi_root ) { fprintf(stream, "Sketching ...................... "); fflush(stream); } + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "Sketching ...................... "); fflush(stream); } double time_s = MPI_Wtime(); fun_s(param, argv_s, argc_s, retv_s, retc_s, dista, ordera, a, lda, yst, ldyst, seed, mpi_root); time_s = MPI_Wtime() - time_s; - if ( stream != nullptr && mpi_rank == mpi_root ) { fprintf(stream, "done\n"); fflush(stream); } + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "done\n"); fflush(stream); } - if ( stream != nullptr && mpi_rank == mpi_root ) { fprintf(stream, "Orthogonalizing ................ "); fflush(stream); } + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "Orthogonalizing ................ "); fflush(stream); } double time_i = MPI_Wtime(); fun_o(param, argv_o, argc_o, retv_o, retc_o, yst, ldyst); time_i = MPI_Wtime() - time_i; - if ( stream != nullptr && mpi_rank == mpi_root ) { fprintf(stream, "done\n"); fflush(stream); } + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "done\n"); fflush(stream); } - if ( stream != nullptr && mpi_rank == mpi_root ) { fprintf(stream, "Integrating .................... "); fflush(stream); } + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "Integrating .................... "); fflush(stream); } double time_o = MPI_Wtime(); fun_i(param, argv_i, argc_i, retv_i, retc_i, yst, ldyst, qt, ldqt); time_o = MPI_Wtime() - time_o; - if ( stream != nullptr && mpi_rank == mpi_root ) { fprintf(stream, "done\n"); fflush(stream); } + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "done\n"); fflush(stream); } - if ( stream != nullptr && mpi_rank == mpi_root ) { fprintf(stream, "Postprocessing ................. "); fflush(stream); } + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "Postprocessing ................. "); fflush(stream); } double time_p = MPI_Wtime(); fun_p(param, argv_p, argc_p, retv_p, retc_p, dista, ordera, a, lda, qt, ldqt, s, ut, ldut, vt, ldvt, ut_root, vt_root); time_p = MPI_Wtime() - time_p; - if ( stream != nullptr && mpi_rank == mpi_root ) { fprintf(stream, "done\n"); fflush(stream); } + if ( stream != NULL && mpi_rank == mpi_root ) { fprintf(stream, "done\n"); fflush(stream); } // ====================================================================================================================== // // Gets executing times - if ( time != nullptr ) { + if ( time != NULL ) { time[0] = time_s; time[1] = time_i; time[2] = time_o; diff --git a/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c b/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c index 5294b52..cc2075c 100644 --- a/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c @@ -41,8 +41,8 @@ void isvd_@x@IntegrateHierarchicalReduction( const isvd_int_t ldqt ) { - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } if ( argc < 0 ) return; // ====================================================================================================================== // @@ -104,7 +104,7 @@ void isvd_@x@IntegrateHierarchicalReduction( isvd_int_t ldqiht = ldqst; // svd(B(i)) = W * S * T' - isvd_@x@Gesvd('O', 'S', l, l, w, ldw, s, nullptr, 1, tt, ldtt); + isvd_@x@Gesvd('O', 'S', l, l, w, ldw, s, NULL, 1, tt, ldtt); // Q(i) := Q(i) * W + Q(i+h) * T (Q(i)' := W' * Q(i)' + T' * Q(i+h)') isvd_@x@Omatcopy('N', l, mj, 1.0, qit, ldqit, tmpt, ldtmpt); diff --git a/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c b/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c index 33f385f..bd8327a 100644 --- a/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c @@ -47,8 +47,8 @@ void isvd_@x@IntegrateKolmogorovNagumo( const isvd_int_t ldqt ) { - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } // ====================================================================================================================== // // Query arguments diff --git a/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c b/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c index 91b8630..d3e6745 100644 --- a/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c @@ -61,8 +61,8 @@ void isvd_@x@IntegrateWenYin( const isvd_int_t ldqt ) { - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } // ====================================================================================================================== // // Query arguments diff --git a/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c b/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c index 7ad27c3..173301a 100644 --- a/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c +++ b/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c @@ -36,8 +36,8 @@ void isvd_@x@OrthogonalizeGramian( const isvd_int_t ldyst ) { - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } if ( argc < 0 ) return; // ====================================================================================================================== // @@ -76,7 +76,7 @@ void isvd_@x@OrthogonalizeGramian( // eig(Wi) = Wi * Si^2 * Wi' for ( isvd_int_t i = 0; i < N; ++i ) { - isvd_@x@Gesvd('O', 'N', l, l, w + i*ldw*l, ldw, s + i*lds, nullptr, 1, nullptr, 1); + isvd_@x@Gesvd('O', 'N', l, l, w + i*ldw*l, ldw, s + i*lds, NULL, 1, NULL, 1); } isvd_v@x@Sqrt(lds*N, s, s); diff --git a/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c b/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c index 94ba2e5..96f73c4 100644 --- a/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c +++ b/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c @@ -32,8 +32,8 @@ void isvd_@x@OrthogonalizeTallSkinnyQr( fprintf(stderr, "Tall-Skinny QR Orthogonalization is not implemented!\n"); - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } if ( argc < 0 ) return; ISVD_UNUSED(param); diff --git a/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c b/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c index 4d9cb93..627dbac 100644 --- a/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c @@ -77,8 +77,8 @@ void isvd_@x@PostprocessGramian( const mpi_int_t vt_root ) { - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } if ( argc < 0 ) return; // ====================================================================================================================== // @@ -94,8 +94,8 @@ void isvd_@x@PostprocessGramian( // ====================================================================================================================== // // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); if ( !dista_ || !ordera_ ) return; if ( ut_root >= 0 ) { @@ -137,7 +137,7 @@ void isvd_@x@PostprocessGramian( // eig(W) = W * S^2 * W' const char jobw_ = (ut_root >= -1 || vt_root >= -1) ? 'O' : 'N'; - isvd_@x@Gesvd(jobw_, 'N', l, l, w, ldw, s, nullptr, 1, nullptr, 1); + isvd_@x@Gesvd(jobw_, 'N', l, l, w, ldw, s, NULL, 1, NULL, 1); isvd_v@x@Sqrt(l, s, s); // ====================================================================================================================== // @@ -151,7 +151,7 @@ void isvd_@x@PostprocessGramian( if ( param.mpi_rank == ut_root ) { MPI_Gather(MPI_IN_PLACE, mb*ldut, MPI_@X_TYPE@, ut, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); } else { - MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, nullptr, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); + MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, NULL, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); } } } @@ -165,7 +165,7 @@ void isvd_@x@PostprocessGramian( if ( param.mpi_rank == vt_root ) { MPI_Gather(MPI_IN_PLACE, nb*ldvt, MPI_@X_TYPE@, vt, nb*ldvt, MPI_@X_TYPE@, vt_root, param.mpi_comm); } else { - MPI_Gather(vt, nb*ldvt, MPI_@X_TYPE@, nullptr, nb*ldvt, MPI_@X_TYPE@, vt_root, param.mpi_comm); + MPI_Gather(vt, nb*ldvt, MPI_@X_TYPE@, NULL, nb*ldvt, MPI_@X_TYPE@, vt_root, param.mpi_comm); } } } diff --git a/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c b/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c index 9e7ee34..df8c7df 100644 --- a/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c @@ -77,8 +77,8 @@ void isvd_@x@PostprocessSymmetric( const mpi_int_t vt_root ) { - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } if ( argc < 0 ) return; ISVD_UNUSED(vt); @@ -97,8 +97,8 @@ void isvd_@x@PostprocessSymmetric( // ====================================================================================================================== // // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); if ( vt_root >= -1 ) { fprintf(stderr, "VT_ROOT must not be set!"); return; @@ -154,7 +154,7 @@ void isvd_@x@PostprocessSymmetric( if ( param.mpi_rank == ut_root ) { MPI_Gather(MPI_IN_PLACE, mb*ldut, MPI_@X_TYPE@, ut, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); } else { - MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, nullptr, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); + MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, NULL, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); } } } diff --git a/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c b/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c index d89240c..a0f0158 100644 --- a/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c @@ -45,8 +45,8 @@ void isvd_@x@PostprocessTallSkinnyQr( fprintf(stderr, "Tall-Skinny QR Postprocessing is not implemented!\n"); - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } if ( argc < 0 ) return; ISVD_UNUSED(param); diff --git a/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c b/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c index 047b317..912ba9d 100644 --- a/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c +++ b/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c @@ -56,15 +56,15 @@ void isvd_@x@SketchGaussianProjection( const mpi_int_t mpi_root ) { - if ( argc > 0 ) { isvd_assert_ne(argv, (void*)(nullptr)); } - if ( retc > 0 ) { isvd_assert_ne(retv, (void*)(nullptr)); } + if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } + if ( retc > 0 ) { isvd_assert_ne(retv, nullptr); } if ( argc < 0 ) return; // ====================================================================================================================== // // Check arguments - const char dista_ = isvd_arg2char("DISTA", dista, "CR", nullptr); - const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", nullptr); + const char dista_ = isvd_arg2char("DISTA", dista, "CR", NULL); + const char ordera_ = isvd_arg2char("ORDERA", ordera, "CR", NULL); if ( !dista_ || !ordera_ ) return; // ====================================================================================================================== // diff --git a/src/lib/libisvd/def.h b/src/lib/libisvd/def.h index 63263c6..cc33244 100644 --- a/src/lib/libisvd/def.h +++ b/src/lib/libisvd/def.h @@ -19,7 +19,7 @@ #define ISVD_UNUSED( x ) (void)(x) #if !defined(__cplusplus) || (__cplusplus < 201103L) - #define nullptr NULL + #define nullptr (void*)(NULL) #endif #if defined(__cplusplus) diff --git a/src/lib/libisvd/la/blas/dimm.c b/src/lib/libisvd/la/blas/dimm.c index abd171b..237eddd 100644 --- a/src/lib/libisvd/la/blas/dimm.c +++ b/src/lib/libisvd/la/blas/dimm.c @@ -14,7 +14,7 @@ @ISVD_LA_BLAS_TYPE_DEFINE@ #define isvd_xDimm( side, m, n, alpha, a, b, ldb, xScal, xMul ) \ - const char side_ = isvd_arg2char("SIDE", side, "LR", nullptr); \ + const char side_ = isvd_arg2char("SIDE", side, "LR", NULL); \ if ( !side_ ) return; \ switch ( side_ ) { \ case 'L': { \ diff --git a/src/lib/libisvd/la/blas/dism.c b/src/lib/libisvd/la/blas/dism.c index 63b9155..1cfa57c 100644 --- a/src/lib/libisvd/la/blas/dism.c +++ b/src/lib/libisvd/la/blas/dism.c @@ -14,7 +14,7 @@ @ISVD_LA_BLAS_TYPE_DEFINE@ #define isvd_xDism( side, m, n, alpha, a, b, ldb, xScal, xDiv ) \ - const char side_ = isvd_arg2char("SIDE", side, "LR", nullptr); \ + const char side_ = isvd_arg2char("SIDE", side, "LR", NULL); \ if ( !side_ ) return; \ switch ( side_ ) { \ case 'L': { \ diff --git a/src/lib/libisvd/la/blas/omatcopy.c b/src/lib/libisvd/la/blas/omatcopy.c index 942871b..6d414d7 100644 --- a/src/lib/libisvd/la/blas/omatcopy.c +++ b/src/lib/libisvd/la/blas/omatcopy.c @@ -50,7 +50,7 @@ static inline float rconjf( const float z ) { return z; } static inline double rconj( const double z ) { return z; } #define isvd_xOmatcopy( trans, m, n, alpha, a, lda, b, ldb, conj ) \ - const char trans_ = isvd_arg2char("TRANS", trans, "NTRC", nullptr); \ + const char trans_ = isvd_arg2char("TRANS", trans, "NTRC", NULL); \ if ( !trans_ ) return; \ switch ( trans_ ) { \ case 'N': { \ diff --git a/src/lib/libisvd/la/lapack/geinv.c b/src/lib/libisvd/la/lapack/geinv.c index 3b7ea63..684b5fb 100644 --- a/src/lib/libisvd/la/lapack/geinv.c +++ b/src/lib/libisvd/la/lapack/geinv.c @@ -42,7 +42,7 @@ void isvd_sGeinv( const INT n, REAL4 *a, const INT lda ) { REAL4 qwork; INT lwork = -1, info; - sgetri_(&n, a, &lda, nullptr, &qwork, &lwork, &info); isvd_assert_pass(info); + sgetri_(&n, a, &lda, NULL, &qwork, &lwork, &info); isvd_assert_pass(info); lwork = qwork; INT *ipiv = isvd_imalloc(n); REAL4 *work = isvd_smalloc(lwork); @@ -55,7 +55,7 @@ void isvd_dGeinv( const INT n, REAL8 *a, const INT lda ) { REAL8 qwork; INT lwork = -1, info; - dgetri_(&n, a, &lda, nullptr, &qwork, &lwork, &info); isvd_assert_pass(info); + dgetri_(&n, a, &lda, NULL, &qwork, &lwork, &info); isvd_assert_pass(info); lwork = qwork; INT *ipiv = isvd_imalloc(n); REAL8 *work = isvd_dmalloc(lwork); @@ -68,7 +68,7 @@ void isvd_cGeinv( const INT n, COMP4 *a, const INT lda ) { COMP4 qwork; INT lwork = -1, info; - cgetri_(&n, a, &lda, nullptr, &qwork, &lwork, &info); isvd_assert_pass(info); + cgetri_(&n, a, &lda, NULL, &qwork, &lwork, &info); isvd_assert_pass(info); lwork = creal(qwork); INT *ipiv = isvd_imalloc(n); COMP4 *work = isvd_cmalloc(lwork); @@ -81,7 +81,7 @@ void isvd_zGeinv( const INT n, COMP8 *a, const INT lda ) { COMP8 qwork; INT lwork = -1, info; - zgetri_(&n, a, &lda, nullptr, &qwork, &lwork, &info); isvd_assert_pass(info); + zgetri_(&n, a, &lda, NULL, &qwork, &lwork, &info); isvd_assert_pass(info); lwork = creal(qwork); INT *ipiv = isvd_imalloc(n); COMP8 *work = isvd_zmalloc(lwork); diff --git a/src/lib/libisvd/la/lapack/gesvd.c b/src/lib/libisvd/la/lapack/gesvd.c index 01eb7cc..26786b0 100644 --- a/src/lib/libisvd/la/lapack/gesvd.c +++ b/src/lib/libisvd/la/lapack/gesvd.c @@ -61,7 +61,7 @@ void isvd_cGesvd( COMP4 *v, const INT ldvt ) { COMP4 qwork; INT lwork = -1, info; - cgesvd_(&jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, v, &ldvt, &qwork, &lwork, nullptr, &info); isvd_assert_pass(info); + cgesvd_(&jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, v, &ldvt, &qwork, &lwork, NULL, &info); isvd_assert_pass(info); lwork = crealf(qwork); COMP4 *work = isvd_cmalloc(lwork); REAL4 *rwork = isvd_smalloc(5*min(m, n)); @@ -74,7 +74,7 @@ void isvd_zGesvd( COMP8 *v, const INT ldvt ) { COMP8 qwork; INT lwork = -1, info; - zgesvd_(&jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, v, &ldvt, &qwork, &lwork, nullptr, &info); isvd_assert_pass(info); + zgesvd_(&jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, v, &ldvt, &qwork, &lwork, NULL, &info); isvd_assert_pass(info); lwork = creal(qwork); COMP8 *work = isvd_zmalloc(lwork); REAL8 *rwork = isvd_dmalloc(5*min(m, n)); diff --git a/src/lib/libisvd/la/lapack/syev.c b/src/lib/libisvd/la/lapack/syev.c index 427be1a..9ad253b 100644 --- a/src/lib/libisvd/la/lapack/syev.c +++ b/src/lib/libisvd/la/lapack/syev.c @@ -57,7 +57,7 @@ void isvd_cSyev( const CHAR1 jobz, const CHAR1 uplo, const INT n, COMP4 *a, const INT lda, REAL4 *w ) { COMP4 qwork; INT lwork = -1, info; - cheev_(&jobz, &uplo, &n, a, &lda, w, &qwork, &lwork, nullptr, &info); isvd_assert_pass(info); + cheev_(&jobz, &uplo, &n, a, &lda, w, &qwork, &lwork, NULL, &info); isvd_assert_pass(info); lwork = creal(qwork); COMP4 *work = isvd_cmalloc(lwork); REAL4 *rwork = isvd_smalloc(5*n-2); @@ -69,7 +69,7 @@ void isvd_zSyev( const CHAR1 jobz, const CHAR1 uplo, const INT n, COMP8 *a, const INT lda, REAL8 *w ) { COMP8 qwork; INT lwork = -1, info; - zheev_(&jobz, &uplo, &n, a, &lda, w, &qwork, &lwork, nullptr, &info); isvd_assert_pass(info); + zheev_(&jobz, &uplo, &n, a, &lda, w, &qwork, &lwork, NULL, &info); isvd_assert_pass(info); lwork = creal(qwork); COMP8 *work = isvd_zmalloc(lwork); REAL8 *rwork = isvd_dmalloc(5*n-2); diff --git a/src/lib/libisvd/util/arg.h b/src/lib/libisvd/util/arg.h index 54b6aea..4668477 100644 --- a/src/lib/libisvd/util/arg.h +++ b/src/lib/libisvd/util/arg.h @@ -24,7 +24,7 @@ static inline isvd_int_t isvd_arg2char( const char *opts, const char *rets ) { - if ( rets == nullptr ) { + if ( rets == NULL ) { rets = opts; } @@ -56,7 +56,7 @@ static inline const char* isvd_arg2str( const char *rets[], const size_t nopts ) { - if ( rets == nullptr ) { + if ( rets == NULL ) { rets = opts; } From ab9a0ae644fe489422e16e856a6ca3b121afa2ae Mon Sep 17 00:00:00 2001 From: Mu Yang Date: Thu, 14 Sep 2017 09:09:47 +0800 Subject: [PATCH 7/8] Update documentation. --- README.md | 8 +++++++- .../tutorial/core/{notation.dox => detail.dox} | 0 doxygen/tutorial/core/example.dox | 18 ++++++++---------- doxygen/tutorial/core/stage.dox | 15 +++++---------- doxygen/tutorial/core/storage.dox | 2 +- doxygen/tutorial/main.dox | 2 +- 6 files changed, 22 insertions(+), 23 deletions(-) rename doxygen/tutorial/core/{notation.dox => detail.dox} (100%) diff --git a/README.md b/README.md index 07f370f..8e1f0e7 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ The following table are the main options ### Makefile -The following table are the main make rules +The following table are the main Makefile rules | Command | Detail | Options | |----------------|--------------------------------|--------------------------------| @@ -78,6 +78,12 @@ The following table are the main make rules | `make doc` | build documentation | Require `ISVD_BUILD_DOC` | | `make help` | display make-rules | | +### Test installation + +* Set `ISVD_BUILD_TEST` using **ccmake**. (Also recommended to unset `ISVD_VERBOSE_TEST` if GPU is enabled). +* Run **make check** + * Known issue: RealSingle_WenYinIntegration.Test.#/s_integrate_wen_yin_# always fail the test. + ## Usage * Define `ISVD_USE_ILP64` before include `isvd.h` to use 64-bit integer. diff --git a/doxygen/tutorial/core/notation.dox b/doxygen/tutorial/core/detail.dox similarity index 100% rename from doxygen/tutorial/core/notation.dox rename to doxygen/tutorial/core/detail.dox diff --git a/doxygen/tutorial/core/example.dox b/doxygen/tutorial/core/example.dox index f8eae07..60ca091 100644 --- a/doxygen/tutorial/core/example.dox +++ b/doxygen/tutorial/core/example.dox @@ -1,11 +1,9 @@ /** \page tutorial_core_example Example Code -

iSVD Example

- \ref isvd_dIsvd "iSVD driver" solves an approximate low-rank singular value decomposition of matrix 𝑨. \ref demo/cdemo.c is an example code. In the following, we describe the details of each part of this example. -

Initialize Environment

+

Initialize Environment

The iSVD environment and random seed should be set up before calling the driver. \ref isvd_init also initialize the MPI environment and the MAGMA environment, and \ref isvd_printEnvironment display the the MPI environment and the MAGMA environment. @@ -13,39 +11,39 @@ \snippetlineno demo/cdemo.c init-isvd -

Load Data

+

Load Data

In this example, we load the data from a Matrix Market format file. Note the all the MPI processors should load the matrix. \snippetlineno demo/cdemo.c load-data -

Allocate matrices

+

Allocate matrices

The output matrices should be allocated before calling the driver. See \ref isvd_dIsvd for the detail of matrix sizes. \snippetlineno demo/cdemo.c allocate-matrix -

Run iSVD

+

Run iSVD

The iSVD driver compute the approximate low-rank singular value decomposition. See \ref isvd_dIsvd for the detail of the arguments. The 𝑗-th MPI-rank stores the 𝑗-th block of the input matrix 𝑨 (see \ref tutorial_core_storage for detail). \snippetlineno demo/cdemo.c run-isvd -

Get Executing Time

+

Get Executing Time

The iSVD driver also records the executing time of each stage. \snippetlineno demo/cdemo.c display-time -

Finalize

+

Finalize

Remember to \ref isvd_finalize "finalize" the environment. \snippetlineno demo/cdemo.c final-isvd -

Possible Result

+

Possible Result

- The following are the possible results of the example code. One may use **make run_cdemo** to run \ref demo/cdemo.c. + One may use **make run_cdemo** to run \ref demo/cdemo.c. If you want to compile it directly, please refer the usage guide in the main page. The following are the possible results of the example code. \code{.txt} iSVD C demo diff --git a/doxygen/tutorial/core/stage.dox b/doxygen/tutorial/core/stage.dox index 2754142..a19f483 100644 --- a/doxygen/tutorial/core/stage.dox +++ b/doxygen/tutorial/core/stage.dox @@ -1,10 +1,8 @@ /** - \page tutorial_core_stage Stages + @page tutorial_core_stage Stages The iSVD algorithm contains four stages: sketching, orthogonalization, integration, and postprocessing. -

Flow Chart

- Stage | Input | Output --------------------|----------------------------------------------------|-------------------------------- sketching | \f$\boldsymbol{A}\f$ | \f$\boldsymbol{\mathfrak{Y}}\f$ @@ -25,21 +23,19 @@ \end{bmatrix}. @f] -

Details

- -

Sketching

+

Sketching

The sketching stage randomly sketches 𝑁 rank-𝑙 column subspaces \f$\boldsymbol{Y}_{[i]}\f$ of the input matrix \f$\boldsymbol{A}\f$. - The \ref isvd_dSketchGaussianProjection "Gramian Projection Sketching" multiples \f$\boldsymbol{A}\f$ by some random matrices using Gaussian normal distribution. -

Orthogonalization

+

Orthogonalization

The orthogonalization stage computes an approximate basis \f$\boldsymbol{Q}_{[i]}\f$ for the range of the input matrix from those \f$\boldsymbol{Y}_{[i]}\f$. - The \ref isvd_dOrthogonalizeGramian "Gramian Orthogonalization" finds the orthonormal basis using the eigen-decomposition of \f$\boldsymbol{Y}_{[i]}^\top \boldsymbol{Y}_{[i]}\f$ — the Gramiam of \f$\boldsymbol{Y}_{[i]}\f$. -

Integration

+

Integration

The integration stage find a kind of average \f$\overline{\boldsymbol{Q}}\f$ of those \f$\boldsymbol{Q}_{[i]}\f$. @@ -47,11 +43,10 @@ - The \ref isvd_dIntegrateWenYin "Wen-Yin Integration" finds the average using line search proposed by Wen and Yin. - The \ref isvd_dIntegrateHierarchicalReduction "Hierarchical Reduction Integration" finds the average using divide and conquer algorithm. Note that it is faster but less accurate. -

Postprocessing

+

Postprocessing

The postprocessing stage forms a rank-𝑘 approximate SVD of \f$\boldsymbol{A}\f$ in the range of \f$\overline{\boldsymbol{Q}}\f$. - The \ref isvd_dPostprocessGramian "Gramian Postprocessing" finds approximate SVD using the eigen-decomposition of \f$\overline{\boldsymbol{Q}}^\top \boldsymbol{A} \boldsymbol{A}^\top \overline{\boldsymbol{Q}}\f$. - The \ref isvd_dPostprocessSymmetric "Symmetric Postprocessing" finds approximate SVD using the eigen-decomposition of \f$\overline{\boldsymbol{Q}}^\top \boldsymbol{A} \overline{\boldsymbol{Q}}\f$ for symmetric input matrix \f$\boldsymbol{A}\f$. - */ diff --git a/doxygen/tutorial/core/storage.dox b/doxygen/tutorial/core/storage.dox index cec1fa0..875354c 100644 --- a/doxygen/tutorial/core/storage.dox +++ b/doxygen/tutorial/core/storage.dox @@ -1,5 +1,5 @@ /** - @page tutorial_core_storage Parallelism Storage + \page tutorial_core_storage Parallelism Storage

Block-Row Storage

diff --git a/doxygen/tutorial/main.dox b/doxygen/tutorial/main.dox index 6d45c69..b0d8a87 100644 --- a/doxygen/tutorial/main.dox +++ b/doxygen/tutorial/main.dox @@ -1,7 +1,7 @@ /** \page tutorial_main Tutorial -

Subpages

+

Subpages

- \subpage tutorial_core_example - \subpage tutorial_core_notation From de22bdd325e1b6e61b626963ddf2ce74e21d6d5f Mon Sep 17 00:00:00 2001 From: Mu Yang Date: Thu, 14 Sep 2017 09:33:27 +0800 Subject: [PATCH 8/8] Add alias of floating point types. --- check/CMakeLists.txt | 4 +- .../@x@_integrate_hierarchical_reduction.cxx | 4 +- .../stage/@x@_integrate_kolmogorov_nagumo.cxx | 4 +- .../core/stage/@x@_integrate_wen_yin.cxx | 4 +- .../core/stage/@x@_orthogonalize_gramian.cxx | 4 +- .../core/stage/@x@_postprocess_gramian.cxx | 6 +- .../core/stage/@x@_postprocess_symmetric.cxx | 4 +- .../stage/@x@_sketch_gaussian_projection.cxx | 4 +- .../gpu/stage/@x@_postprocess_gramian_gpu.cxx | 6 +- .../stage/@x@_postprocess_symmetric_gpu.cxx | 4 +- .../@x@_sketch_gaussian_projection_gpu.cxx | 4 +- check/lib/CMakeLists.txt | 43 +++--- cmake/vars.cmake | 30 ++-- cpplint/CMakeLists.txt | 15 +- src/include/c/isvd/core/@x@_driver.h | 6 +- src/include/c/isvd/core/@x@_stage.h | 47 +++--- src/include/c/isvd/def.h | 16 +++ src/include/c/isvd/gpu/@x@_stage.h | 27 ++-- src/include/c/isvd/la/blas/blas1.h | 4 +- src/include/c/isvd/la/blas/blas2.h | 4 +- src/include/c/isvd/la/blas/blas3.h | 4 +- src/include/c/isvd/la/blas/blas_like.h | 4 +- src/include/c/isvd/la/lapack/auxiliary.h | 4 +- src/include/c/isvd/la/lapack/least_square.h | 4 +- .../c/isvd/la/lapack/linear_equation.h | 4 +- src/include/c/isvd/la/vml/mathematical.h | 4 +- src/include/c/isvd/la/vml/power_root.h | 4 +- src/include/c/isvd/la/vsl/distribution.h | 4 +- src/include/c/isvd/la/vsl/driver.h | 4 +- src/include/c/isvd/la/vsl/service.h | 4 +- src/include/c/isvd/util/io.h | 10 +- src/include/c/isvd/util/memory.h | 36 ++--- src/include/c/isvd/util/mpi.h | 12 ++ src/lib/libisvd/core/driver/@x@_isvd.c | 92 ++++++------ .../@x@_integrate_hierarchical_reduction.c | 37 ++--- .../stage/@x@_integrate_kolmogorov_nagumo.c | 61 ++++---- .../core/stage/@x@_integrate_wen_yin.c | 93 ++++++------ .../core/stage/@x@_orthogonalize_gramian.c | 23 +-- .../stage/@x@_orthogonalize_tall_skinny_qr.c | 15 +- src/lib/libisvd/core/stage/@x@_postprocess.h | 57 ++++---- .../core/stage/@x@_postprocess_gramian.c | 50 +++---- .../core/stage/@x@_postprocess_symmetric.c | 46 +++--- .../stage/@x@_postprocess_tall_skinny_qr.c | 36 ++--- src/lib/libisvd/core/stage/@x@_sketch.h | 41 +++--- .../stage/@x@_sketch_gaussian_projection.c | 26 ++-- .../libisvd/gpu/stage/@x@_postprocess_gpu.h | 85 +++++------ src/lib/libisvd/gpu/stage/@x@_sketch_gpu.h | 73 +++++----- src/lib/libisvd/la/blas/dimm.c | 4 +- src/lib/libisvd/la/blas/dism.c | 4 +- src/lib/libisvd/la/blas/gemmt.c | 4 +- src/lib/libisvd/la/blas/iamax.c | 4 +- src/lib/libisvd/la/blas/iamin.c | 4 +- src/lib/libisvd/la/blas/omatcopy.c | 8 +- src/lib/libisvd/la/def.h | 4 +- src/lib/libisvd/la/lapack/geinv.c | 4 +- src/lib/libisvd/la/lapack/gesvd.c | 4 +- src/lib/libisvd/la/lapack/lsame.c | 4 +- src/lib/libisvd/la/lapack/syev.c | 4 +- src/lib/libisvd/la/util/memory.c | 64 +++++---- src/lib/libisvd/la/vml/div.c | 4 +- src/lib/libisvd/la/vml/mul.c | 4 +- src/lib/libisvd/la/vml/sqrt.c | 4 +- src/lib/libisvd/la/vml/sub.c | 4 +- .../libisvd/la/vsl/@x@_rng_gaussian_driver.c | 6 +- src/lib/libisvd/la/vsl/rng_gaussian.c | 4 +- src/lib/libisvd/la/vsl/service.c | 4 +- src/lib/libisvd/nogpu/@x@_stage.c | 134 +++++++++--------- src/lib/libisvd/util/io.c | 18 ++- src/lib/libisvd/util/mpi.c | 5 - 69 files changed, 713 insertions(+), 659 deletions(-) diff --git a/check/CMakeLists.txt b/check/CMakeLists.txt index 739f7af..a47dafb 100644 --- a/check/CMakeLists.txt +++ b/check/CMakeLists.txt @@ -35,7 +35,7 @@ function(ISVD_SET_TARGET_CHECK_CPU target) isvd_set_target_mpi(${target} CXX) isvd_set_target_blas(${target}) isvd_set_target_gtest(${target}) - target_link_libraries(${target} checkisvd extmmio) + target_link_libraries(${target} checkisvd_gpu_none checkisvd_core_la extmmio) target_compile_definitions(${target} PUBLIC "-DISVD_DATA_PATH=\"${PROJECT_SOURCE_DIR}/data\"") endfunction() @@ -45,7 +45,7 @@ function(ISVD_SET_TARGET_CHECK_GPU target) isvd_set_target_blas(${target}) isvd_set_target_gtest(${target}) isvd_set_target_gpu(${target}) - target_link_libraries(${target} checkisvd_gpu extmmio) + target_link_libraries(${target} checkisvd_gpu_magma checkisvd_core_la extmmio) target_compile_definitions(${target} PUBLIC "-DISVD_DATA_PATH=\"${PROJECT_SOURCE_DIR}/data\"") endfunction() diff --git a/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx b/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx index 8f6d775..33e9f1b 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_hierarchical_reduction.cxx @@ -10,7 +10,7 @@ #define serr 1e-3 #define derr 1e-8 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; TEST(@XStr@_HierarchicalReductionIntegration, Test) { @@ -97,7 +97,7 @@ TEST(@XStr@_HierarchicalReductionIntegration, Test) { // Gather results isvd_val_t *qt_ = isvd_@x@malloc(l * Pmb); isvd_int_t ldqt_ = l; - MPI_Gather(qt, mb*ldqt, MPI_@X_TYPE@, qt_, mb*ldqt, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(qt, mb*ldqt, MPI_@XTYPE@, qt_, mb*ldqt, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); if ( mpi_rank == mpi_root ) { // Compute space diff --git a/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx b/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx index a898436..e120dd7 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.cxx @@ -15,7 +15,7 @@ #define serr 1e-3 #define derr 1e-8 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; TEST(@XStr@_KolmogorovNagumoIntegration, Test) { @@ -107,7 +107,7 @@ TEST(@XStr@_KolmogorovNagumoIntegration, Test) { // Gather results isvd_val_t *qt_ = isvd_@x@malloc(l * Pmb); isvd_int_t ldqt_ = l; - MPI_Gather(qt, mb*ldqt, MPI_@X_TYPE@, qt_, mb*ldqt, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(qt, mb*ldqt, MPI_@XTYPE@, qt_, mb*ldqt, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); // Check results if ( mpi_rank == mpi_root ) { diff --git a/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx b/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx index 70acfe7..a0a753b 100644 --- a/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx +++ b/check/check/libisvd/core/stage/@x@_integrate_wen_yin.cxx @@ -15,7 +15,7 @@ #define serr 1e-3 #define derr 1e-8 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; TEST(@XStr@_WenYinIntegration, Test) { @@ -107,7 +107,7 @@ TEST(@XStr@_WenYinIntegration, Test) { // Gather results isvd_val_t *qt_ = isvd_@x@malloc(l * Pmb); isvd_int_t ldqt_ = l; - MPI_Gather(qt, mb*ldqt, MPI_@X_TYPE@, qt_, mb*ldqt, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(qt, mb*ldqt, MPI_@XTYPE@, qt_, mb*ldqt, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); // Check results if ( mpi_rank == mpi_root ) { diff --git a/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx b/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx index bf37456..d72eaca 100644 --- a/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx +++ b/check/check/libisvd/core/stage/@x@_orthogonalize_gramian.cxx @@ -10,7 +10,7 @@ #define serr 1e-3 #define derr 1e-8 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; TEST(@XStr@_GramianOrthogonalization, Test) { @@ -95,7 +95,7 @@ TEST(@XStr@_GramianOrthogonalization, Test) { // Gather results isvd_val_t *qst_ = isvd_@x@malloc(Pmb * ldyst); isvd_int_t ldqst_ = ldyst; - MPI_Gather(yst, mb*ldyst, MPI_@X_TYPE@, qst_, mb*ldyst, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(yst, mb*ldyst, MPI_@XTYPE@, qst_, mb*ldyst, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); if ( mpi_rank == mpi_root ) { // Compute space diff --git a/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx b/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx index c352f73..3262efb 100644 --- a/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx +++ b/check/check/libisvd/core/stage/@x@_postprocess_gramian.cxx @@ -13,7 +13,7 @@ #define serr 1e-3 #define derr 1e-8 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; typedef enum { GatherUV, @@ -236,8 +236,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { a, lda, qt, ldqt, s, ut, ldut, vt, ldvt, -1, -1); // Gather results - MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, ut_, mb*ldut, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); - MPI_Gather(vt, nb*ldvt, MPI_@X_TYPE@, vt_, nb*ldvt, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(ut, mb*ldut, MPI_@XTYPE@, ut_, mb*ldut, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(vt, nb*ldvt, MPI_@XTYPE@, vt_, nb*ldvt, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); // Deallocate memory isvd_free(ut); diff --git a/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx b/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx index 6855eda..e5ac46d 100644 --- a/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx +++ b/check/check/libisvd/core/stage/@x@_postprocess_symmetric.cxx @@ -12,7 +12,7 @@ #define serr 1e-3 #define derr 1e-8 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; typedef enum { GatherUV, @@ -203,7 +203,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { a, lda, qt, ldqt, s, ut, ldut, NULL, 0, -1, -2); // Gather results - MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, ut_, mb*ldut, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(ut, mb*ldut, MPI_@XTYPE@, ut_, mb*ldut, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); // Deallocate memory isvd_free(ut); diff --git a/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx b/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx index c552ffc..86c2dea 100644 --- a/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx +++ b/check/check/libisvd/core/stage/@x@_sketch_gaussian_projection.cxx @@ -10,7 +10,7 @@ #define serr 1e-1 #define derr 1e-6 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; static void test( char dista, char ordera ) { @@ -125,7 +125,7 @@ static void test( char dista, char ordera ) { // Gather results isvd_val_t *yst_ = isvd_@x@malloc(Nl * Pmb); isvd_int_t ldyst_ = Nl; - MPI_Gather(yst, mb*ldyst, MPI_@X_TYPE@, yst_, mb*ldyst, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(yst, mb*ldyst, MPI_@XTYPE@, yst_, mb*ldyst, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); // Check results if ( mpi_rank == mpi_root ) { diff --git a/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx index 7371fc7..2f6cfb1 100644 --- a/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_postprocess_gramian_gpu.cxx @@ -13,7 +13,7 @@ #define serr 1e-3 #define derr 1e-8 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; typedef enum { GatherUV, @@ -236,8 +236,8 @@ static void test( char dista, char ordera, const JobUV jobuv ) { a, lda, qt, ldqt, s, ut, ldut, vt, ldvt, -1, -1); // Gather results - MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, ut_, mb*ldut, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); - MPI_Gather(vt, nb*ldvt, MPI_@X_TYPE@, vt_, nb*ldvt, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(ut, mb*ldut, MPI_@XTYPE@, ut_, mb*ldut, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(vt, nb*ldvt, MPI_@XTYPE@, vt_, nb*ldvt, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); // Deallocate memory isvd_free(ut); diff --git a/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx index a4d0757..d041385 100644 --- a/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_postprocess_symmetric_gpu.cxx @@ -12,7 +12,7 @@ #define serr 1e-3 #define derr 1e-8 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; typedef enum { GatherUV, @@ -203,7 +203,7 @@ static void test( char dista, char ordera, const JobUV jobuv ) { a, lda, qt, ldqt, s, ut, ldut, NULL, 0, -1, -2); // Gather results - MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, ut_, mb*ldut, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(ut, mb*ldut, MPI_@XTYPE@, ut_, mb*ldut, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); // Deallocate memory isvd_free(ut); diff --git a/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx b/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx index 213694c..609de5a 100644 --- a/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx +++ b/check/check/libisvd/gpu/stage/@x@_sketch_gaussian_projection_gpu.cxx @@ -10,7 +10,7 @@ #define serr 1e-1 #define derr 1e-6 -typedef @xtype@ isvd_val_t; +typedef @xtype_____@ isvd_val_t; static void test( char dista, char ordera ) { @@ -125,7 +125,7 @@ static void test( char dista, char ordera ) { // Gather results isvd_val_t *yst_ = isvd_@x@malloc(Nl * Pmb); isvd_int_t ldyst_ = Nl; - MPI_Gather(yst, mb*ldyst, MPI_@X_TYPE@, yst_, mb*ldyst, MPI_@X_TYPE@, mpi_root, MPI_COMM_WORLD); + MPI_Gather(yst, mb*ldyst, MPI_@XTYPE@, yst_, mb*ldyst, MPI_@XTYPE@, mpi_root, MPI_COMM_WORLD); // Check results if ( mpi_rank == mpi_root ) { diff --git a/check/lib/CMakeLists.txt b/check/lib/CMakeLists.txt index 293b51a..59e4584 100644 --- a/check/lib/CMakeLists.txt +++ b/check/lib/CMakeLists.txt @@ -13,29 +13,30 @@ endforeach() file(RENAME "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/core/param.cxx" "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/core/param.c") -# checkisvd +# checkisvd_core_la file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/core/*" "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/la/*" - "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/util/*" - "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/nogpu/*") -add_library(checkisvd EXCLUDE_FROM_ALL ${files}) -isvd_set_target(checkisvd) -isvd_set_target_omp(checkisvd CXX) -isvd_set_target_mpi(checkisvd CXX) -isvd_set_target_blas(checkisvd) -isvd_set_target_gtest(checkisvd) + "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/util/*") +add_library(checkisvd_core_la EXCLUDE_FROM_ALL ${files}) +isvd_set_target(checkisvd_core_la) +isvd_set_target_omp(checkisvd_core_la CXX) +isvd_set_target_mpi(checkisvd_core_la CXX) +isvd_set_target_blas(checkisvd_core_la) +isvd_set_target_gtest(checkisvd_core_la) -# checkisvd_gpu +# checkisvd_gpu_none +file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/nogpu/*") +add_library(checkisvd_gpu_none EXCLUDE_FROM_ALL ${files}) +isvd_set_target(checkisvd_gpu_none) +isvd_set_target_mpi(checkisvd_gpu_none CXX) +isvd_set_target_gtest(checkisvd_gpu_none) + +# checkisvd_gpu_magma if(ISVD_USE_GPU) - file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/core/*" - "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/la/*" - "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/util/*" - "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/gpu/*") - add_library(checkisvd_gpu EXCLUDE_FROM_ALL ${files}) - isvd_set_target(checkisvd_gpu) - isvd_set_target_omp(checkisvd_gpu CXX) - isvd_set_target_mpi(checkisvd_gpu CXX) - isvd_set_target_blas(checkisvd_gpu) - isvd_set_target_gpu(checkisvd_gpu) - isvd_set_target_gtest(checkisvd_gpu) + file(GLOB_RECURSE files "${CMAKE_CURRENT_CONFIG_DIR}/libisvd/gpu/*") + add_library(checkisvd_gpu_magma EXCLUDE_FROM_ALL ${files}) + isvd_set_target(checkisvd_gpu_magma) + isvd_set_target_mpi(checkisvd_gpu_magma CXX) + isvd_set_target_gpu(checkisvd_gpu_magma) + isvd_set_target_gtest(checkisvd_gpu_magma) endif() diff --git a/cmake/vars.cmake b/cmake/vars.cmake index 97d3464..c69fbcd 100644 --- a/cmake/vars.cmake +++ b/cmake/vars.cmake @@ -1,11 +1,11 @@ # Types definitions -macro(ISVD_SET_TYPES x_ xtype_ x_type_ XName_ XStr_) +macro(ISVD_SET_TYPES x_ xtype_ XName_ XStr_) string(TOLOWER "${x_}" x) string(TOUPPER "${x_}" X) - set(xtype ${xtype_}) + set(xtype_____ ${xtype_}) - string(TOUPPER "${x_type_}" X_TYPE) + string(TOUPPER "${xtype_}" XTYPE) string(TOLOWER "${XName_}" xname) set(XName "${XName_}") @@ -17,25 +17,25 @@ unset(ISVD_S_TYPES) unset(ISVD_D_TYPES) unset(ISVD_C_TYPES) unset(ISVD_Z_TYPES) -list(APPEND ISVD_S_TYPES "s" "float" "float" "Real Single" "RealSingle") -list(APPEND ISVD_D_TYPES "d" "double" "double" "Real Double" "RealDouble") -list(APPEND ISVD_C_TYPES "c" "_Complex float" "complex_float" "Complex Single" "ComplexSingle") -list(APPEND ISVD_Z_TYPES "z" "_Complex double" "complex_double" "Complex Double" "ComplexDouble") +list(APPEND ISVD_S_TYPES "s" "isvd_s_val_t" "Real Single" "RealSingle") +list(APPEND ISVD_D_TYPES "d" "isvd_d_val_t" "Real Double" "RealDouble") +list(APPEND ISVD_C_TYPES "c" "isvd_c_val_t" "Complex Single" "ComplexSingle") +list(APPEND ISVD_Z_TYPES "z" "isvd_z_val_t" "Complex Double" "ComplexDouble") # BLAS definitions set( - ISVD_LA_BLAS_TYPE_DEFINE + ISVD_TYPE_MACRO_DEFINE "#define CHAR1 char" "#define INT isvd_int_t" - "#define REAL4 float" - "#define REAL8 double" - "#define COMP4 _Complex float" - "#define COMP8 _Complex double" + "#define REAL4 isvd_s_val_t" + "#define REAL8 isvd_d_val_t" + "#define COMP4 isvd_c_val_t" + "#define COMP8 isvd_z_val_t" ) -string(REPLACE ";" "\n" ISVD_LA_BLAS_TYPE_DEFINE "${ISVD_LA_BLAS_TYPE_DEFINE}") +string(REPLACE ";" "\n" ISVD_TYPE_MACRO_DEFINE "${ISVD_TYPE_MACRO_DEFINE}") set( - ISVD_LA_BLAS_TYPE_UNDEF + ISVD_TYPE_MACRO_UNDEF "#undef CHAR1" "#undef INT" "#undef REAL4" @@ -43,4 +43,4 @@ set( "#undef COMP4" "#undef COMP8" ) -string(REPLACE ";" "\n" ISVD_LA_BLAS_TYPE_UNDEF "${ISVD_LA_BLAS_TYPE_UNDEF}") +string(REPLACE ";" "\n" ISVD_TYPE_MACRO_UNDEF "${ISVD_TYPE_MACRO_UNDEF}") diff --git a/cpplint/CMakeLists.txt b/cpplint/CMakeLists.txt index 54fed26..642d100 100644 --- a/cpplint/CMakeLists.txt +++ b/cpplint/CMakeLists.txt @@ -5,15 +5,14 @@ find_program(CMAKE_CPPLINT cpplint) mark_as_advanced(CMAKE_CPPLINT) # Macro -function(SET_CPPLINT_TARGET path) +function(SET_CPPLINT_TARGET path linelength filter) string(REPLACE "/" "_" target ${path}) - add_custom_target( - cpplint_${target} - COMMAND ${CMAKE_CPPLINT} --recursive --root=${PROJECT_BINARY_DIR}/${path} ${ARGN} ${path} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + add_custom_command( + TARGET cpplint POST_BUILD + COMMAND ${CMAKE_CPPLINT} --recursive --root="${PROJECT_BINARY_DIR}/${path}" --linelength=${linelength} --filter=${filter} ${path} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" COMMENT "Run cpplint for ${path}" ) - add_dependencies(cpplint cpplint_${target}) endfunction() # CppLint @@ -24,5 +23,5 @@ add_custom_target( COMMENT "Run cpplint" ) -set_cpplint_target(include/c --linelength=128 --filter=-build/include,-build/include_order,-readability/casting,-whitespace/blank_line,-whitespace/braces,-whitespace/parens) -set_cpplint_target(lib --linelength=128 --filter=-build/include,-build/include_order,-build/include_what_you_use,-readability/casting,-whitespace/blank_line,-whitespace/braces,-whitespace/parens) +set_cpplint_target(include/c 128 "-build/include,-build/include_order,-readability/casting,-whitespace/blank_line,-whitespace/braces,-whitespace/parens") +set_cpplint_target(lib 128 "-build/include,-build/include_order,-build/include_what_you_use,-readability/casting,-whitespace/blank_line,-whitespace/braces,-whitespace/parens") diff --git a/src/include/c/isvd/core/@x@_driver.h b/src/include/c/isvd/core/@x@_driver.h index 616537e..69d7942 100644 --- a/src/include/c/isvd/core/@x@_driver.h +++ b/src/include/c/isvd/core/@x@_driver.h @@ -19,10 +19,10 @@ extern "C" { void isvd_@x@Isvd( const char *alg_s, const char *alg_o, const char *alg_i, const char *alg_p, const isvd_int_t m, const isvd_int_t n, const isvd_int_t k, const isvd_int_t p, const isvd_int_t N, - const @xtype@ *argv[4], const isvd_int_t argc[4], @xtype@ *retv[4], const isvd_int_t retc[4], + const @xtype_____@ *argv[4], const isvd_int_t argc[4], @xtype_____@ *retv[4], const isvd_int_t retc[4], double time[4], FILE *stream, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, - @xtype@ *s, @xtype@ *ut, const isvd_int_t ldut, @xtype@ *vt, const isvd_int_t ldvt, + const char dista, const char ordera, const @xtype_____@ *a, const isvd_int_t lda, + @xtype_____@ *s, @xtype_____@ *ut, const isvd_int_t ldut, @xtype_____@ *vt, const isvd_int_t ldvt, const isvd_int_t seed, const mpi_int_t ut_root, const mpi_int_t vt_root, const mpi_int_t mpi_root, const isvd_MpiComm mpi_comm ); diff --git a/src/include/c/isvd/core/@x@_stage.h b/src/include/c/isvd/core/@x@_stage.h index 4c2b9ff..c54cdb8 100644 --- a/src/include/c/isvd/core/@x@_stage.h +++ b/src/include/c/isvd/core/@x@_stage.h @@ -18,57 +18,60 @@ extern "C" { // Sketching void isvd_@x@SketchGaussianProjection( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, - @xtype@ *yst, const isvd_int_t ldyst, const isvd_int_t seed, const mpi_int_t mpi_root + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const char dista, const char ordera, const @xtype_____@ *a, const isvd_int_t lda, + @xtype_____@ *yst, const isvd_int_t ldyst, const isvd_int_t seed, const mpi_int_t mpi_root ); // Orthogonalization void isvd_@x@OrthogonalizeTallSkinnyQr( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - @xtype@ *yst, const isvd_int_t ldyst + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + @xtype_____@ *yst, const isvd_int_t ldyst ); void isvd_@x@OrthogonalizeGramian( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - @xtype@ *yst, const isvd_int_t ldyst + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + @xtype_____@ *yst, const isvd_int_t ldyst ); // Integration void isvd_@x@IntegrateKolmogorovNagumo( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const @xtype@ *yst, const isvd_int_t ldyst, @xtype@ *qt, const isvd_int_t ldqt + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const @xtype_____@ *yst, const isvd_int_t ldyst, @xtype_____@ *qt, const isvd_int_t ldqt ); void isvd_@x@IntegrateWenYin( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const @xtype@ *yst, const isvd_int_t ldyst, @xtype@ *qt, const isvd_int_t ldqt + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const @xtype_____@ *yst, const isvd_int_t ldyst, @xtype_____@ *qt, const isvd_int_t ldqt ); void isvd_@x@IntegrateHierarchicalReduction( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - @xtype@ *yst, const isvd_int_t ldyst, @xtype@ *qt, const isvd_int_t ldqt + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + @xtype_____@ *yst, const isvd_int_t ldyst, @xtype_____@ *qt, const isvd_int_t ldqt ); // Postprocessing void isvd_@x@PostprocessTallSkinnyQr( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, const @xtype@ *qt, const isvd_int_t ldqt, - @xtype@ *s, @xtype@ *ut, const isvd_int_t ldut, @xtype@ *vt, const isvd_int_t ldvt, + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const char dista, const char ordera, + const @xtype_____@ *a, const isvd_int_t lda, const @xtype_____@ *qt, const isvd_int_t ldqt, + @xtype_____@ *s, @xtype_____@ *ut, const isvd_int_t ldut, @xtype_____@ *vt, const isvd_int_t ldvt, const mpi_int_t ut_root, const mpi_int_t vt_root ); void isvd_@x@PostprocessGramian( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, const @xtype@ *qt, const isvd_int_t ldqt, - @xtype@ *s, @xtype@ *ut, const isvd_int_t ldut, @xtype@ *vt, const isvd_int_t ldvt, + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const char dista, const char ordera, + const @xtype_____@ *a, const isvd_int_t lda, const @xtype_____@ *qt, const isvd_int_t ldqt, + @xtype_____@ *s, @xtype_____@ *ut, const isvd_int_t ldut, @xtype_____@ *vt, const isvd_int_t ldvt, const mpi_int_t ut_root, const mpi_int_t vt_root ); void isvd_@x@PostprocessSymmetric( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, const @xtype@ *qt, const isvd_int_t ldqt, - @xtype@ *s, @xtype@ *ut, const isvd_int_t ldut, @xtype@ *vt, const isvd_int_t ldvt, + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const char dista, const char ordera, + const @xtype_____@ *a, const isvd_int_t lda, const @xtype_____@ *qt, const isvd_int_t ldqt, + @xtype_____@ *s, @xtype_____@ *ut, const isvd_int_t ldut, @xtype_____@ *vt, const isvd_int_t ldvt, const mpi_int_t ut_root, const mpi_int_t vt_root ); diff --git a/src/include/c/isvd/def.h b/src/include/c/isvd/def.h index 8108fa1..a346232 100644 --- a/src/include/c/isvd/def.h +++ b/src/include/c/isvd/def.h @@ -64,6 +64,22 @@ typedef uint64_t isvd_uint_t; typedef uintN_t isvd_uint_t; #endif // DOXYGEN_SHOULD_SKIP_THIS +/// \ingroup c_core_module +/// \brief The type of real single floating point. +typedef float isvd_s_val_t; + +/// \ingroup c_core_module +/// \brief The type of real double floating point. +typedef double isvd_d_val_t; + +/// \ingroup c_core_module +/// \brief The type of complex single floating point. +typedef _Complex float isvd_c_val_t; + +/// \ingroup c_core_module +/// \brief The type of complex double floating point. +typedef _Complex double isvd_z_val_t; + /// \ingroup c_core_module /// \brief The type of MPI index. typedef int mpi_int_t; diff --git a/src/include/c/isvd/gpu/@x@_stage.h b/src/include/c/isvd/gpu/@x@_stage.h index 6c0c1d1..62cefab 100644 --- a/src/include/c/isvd/gpu/@x@_stage.h +++ b/src/include/c/isvd/gpu/@x@_stage.h @@ -25,9 +25,9 @@ extern "C" { /// \attention Set \ref isvd_gpu_memory_limit as the limit of GPU memory usage. /// void isvd_@x@SketchGaussianProjection_gpu( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, - @xtype@ *yst, const isvd_int_t ldyst, const isvd_int_t seed, const mpi_int_t mpi_root + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const char dista, const char ordera, const @xtype_____@ *a, const isvd_int_t lda, + @xtype_____@ *yst, const isvd_int_t ldyst, const isvd_int_t seed, const mpi_int_t mpi_root ); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -39,9 +39,10 @@ void isvd_@x@SketchGaussianProjection_gpu( /// \attention Set \ref isvd_gpu_memory_limit as the limit of GPU memory usage. /// void isvd_@x@PostprocessTallSkinnyQr_gpu( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, const @xtype@ *qt, const isvd_int_t ldqt, - @xtype@ *s, @xtype@ *ut, const isvd_int_t ldut, @xtype@ *vt, const isvd_int_t ldvt, + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const char dista, const char ordera, + const @xtype_____@ *a, const isvd_int_t lda, const @xtype_____@ *qt, const isvd_int_t ldqt, + @xtype_____@ *s, @xtype_____@ *ut, const isvd_int_t ldut, @xtype_____@ *vt, const isvd_int_t ldvt, const mpi_int_t ut_root, const mpi_int_t vt_root ); @@ -54,9 +55,10 @@ void isvd_@x@PostprocessTallSkinnyQr_gpu( /// \attention Set \ref isvd_gpu_memory_limit as the limit of GPU memory usage. /// void isvd_@x@PostprocessGramian_gpu( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, const @xtype@ *qt, const isvd_int_t ldqt, - @xtype@ *s, @xtype@ *ut, const isvd_int_t ldut, @xtype@ *vt, const isvd_int_t ldvt, + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const char dista, const char ordera, + const @xtype_____@ *a, const isvd_int_t lda, const @xtype_____@ *qt, const isvd_int_t ldqt, + @xtype_____@ *s, @xtype_____@ *ut, const isvd_int_t ldut, @xtype_____@ *vt, const isvd_int_t ldvt, const mpi_int_t ut_root, const mpi_int_t vt_root ); @@ -69,9 +71,10 @@ void isvd_@x@PostprocessGramian_gpu( /// \attention Set \ref isvd_gpu_memory_limit as the limit of GPU memory usage. /// void isvd_@x@PostprocessSymmetric_gpu( - const isvd_Param param, const @xtype@ *argv, const isvd_int_t argc, @xtype@ *retv, const isvd_int_t retc, - const char dista, const char ordera, const @xtype@ *a, const isvd_int_t lda, const @xtype@ *qt, const isvd_int_t ldqt, - @xtype@ *s, @xtype@ *ut, const isvd_int_t ldut, @xtype@ *vt, const isvd_int_t ldvt, + const isvd_Param param, const @xtype_____@ *argv, const isvd_int_t argc, @xtype_____@ *retv, const isvd_int_t retc, + const char dista, const char ordera, + const @xtype_____@ *a, const isvd_int_t lda, const @xtype_____@ *qt, const isvd_int_t ldqt, + @xtype_____@ *s, @xtype_____@ *ut, const isvd_int_t ldut, @xtype_____@ *vt, const isvd_int_t ldvt, const mpi_int_t ut_root, const mpi_int_t vt_root ); diff --git a/src/include/c/isvd/la/blas/blas1.h b/src/include/c/isvd/la/blas/blas1.h index f0e6b67..ec24ebf 100644 --- a/src/include/c/isvd/la/blas/blas1.h +++ b/src/include/c/isvd/la/blas/blas1.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if !defined(DOXYGEN_SHOULD_SKIP_THIS) @@ -169,7 +169,7 @@ static inline void isvd_zdScal( ) { zdscal_(&n, &alpha, x, &incx); } //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/blas/blas2.h b/src/include/c/isvd/la/blas/blas2.h index ae4d7e2..96ffe77 100644 --- a/src/include/c/isvd/la/blas/blas2.h +++ b/src/include/c/isvd/la/blas/blas2.h @@ -15,13 +15,13 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if !defined(DOXYGEN_SHOULD_SKIP_THIS) #endif // DOXYGEN_SHOULD_SKIP_THIS -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/blas/blas3.h b/src/include/c/isvd/la/blas/blas3.h index 0769a96..9c89688 100644 --- a/src/include/c/isvd/la/blas/blas3.h +++ b/src/include/c/isvd/la/blas/blas3.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if !defined(DOXYGEN_SHOULD_SKIP_THIS) @@ -102,7 +102,7 @@ static inline void isvd_zSyrk( ) { zherk_(&uplo, &trans, &n, &k, &alpha, a, &lda, &beta, c, &ldc); } //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/blas/blas_like.h b/src/include/c/isvd/la/blas/blas_like.h index 39f25c6..978172c 100644 --- a/src/include/c/isvd/la/blas/blas_like.h +++ b/src/include/c/isvd/la/blas/blas_like.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_la_blas_like_module @@ -96,7 +96,7 @@ void isvd_zGemmt( ); //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/lapack/auxiliary.h b/src/include/c/isvd/la/lapack/auxiliary.h index 66f04d9..8bd65e1 100644 --- a/src/include/c/isvd/la/lapack/auxiliary.h +++ b/src/include/c/isvd/la/lapack/auxiliary.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if !defined(DOXYGEN_SHOULD_SKIP_THIS) @@ -54,7 +54,7 @@ bool isvd_Lsame( const CHAR1 ca, const CHAR1 cb ); /// \brief Tests two character strings for equality regardless of the case. bool isvd_Lsamen( const INT n, const CHAR1 *sa, const CHAR1 *sb ); -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/lapack/least_square.h b/src/include/c/isvd/la/lapack/least_square.h index 15f17d6..98dd62e 100644 --- a/src/include/c/isvd/la/lapack/least_square.h +++ b/src/include/c/isvd/la/lapack/least_square.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_la_lapack_ls_module @@ -41,7 +41,7 @@ void isvd_zGesvd( const CHAR1 jobu, const CHAR1 jobvt, const INT m, const INT n, const INT ldu, COMP8 *v, const INT ldvt ); //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/lapack/linear_equation.h b/src/include/c/isvd/la/lapack/linear_equation.h index a339cd7..83fdd1f 100644 --- a/src/include/c/isvd/la/lapack/linear_equation.h +++ b/src/include/c/isvd/la/lapack/linear_equation.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_la_lapack_le_module @@ -27,7 +27,7 @@ void isvd_cGeinv( const INT n, COMP4 *a, const INT lda ); void isvd_zGeinv( const INT n, COMP8 *a, const INT lda ); //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/vml/mathematical.h b/src/include/c/isvd/la/vml/mathematical.h index ca43144..1401138 100644 --- a/src/include/c/isvd/la/vml/mathematical.h +++ b/src/include/c/isvd/la/vml/mathematical.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_la_vml_math_module @@ -47,7 +47,7 @@ void isvd_vcSqrt( const INT n, const COMP4 *a, COMP4 *y ); void isvd_vzSqrt( const INT n, const COMP8 *a, COMP8 *y ); //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/vml/power_root.h b/src/include/c/isvd/la/vml/power_root.h index d41dab7..e3dca13 100644 --- a/src/include/c/isvd/la/vml/power_root.h +++ b/src/include/c/isvd/la/vml/power_root.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_la_vml_math_module @@ -27,7 +27,7 @@ void isvd_vcDiv( const INT n, const COMP4 *a, const COMP4 *b, COMP4 *y ); void isvd_vzDiv( const INT n, const COMP8 *a, const COMP8 *b, COMP8 *y ); //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/vsl/distribution.h b/src/include/c/isvd/la/vsl/distribution.h index f405a80..24ee155 100644 --- a/src/include/c/isvd/la/vsl/distribution.h +++ b/src/include/c/isvd/la/vsl/distribution.h @@ -16,7 +16,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_la_vsl_distribution_module @@ -26,7 +26,7 @@ void isvd_vsRngGaussian( isvd_VSLStreamStatePtr stream, const INT n, REAL4 *r, c void isvd_vdRngGaussian( isvd_VSLStreamStatePtr stream, const INT n, REAL8 *r, const REAL8 a, const REAL8 sigma ); //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/vsl/driver.h b/src/include/c/isvd/la/vsl/driver.h index 2588958..8d05a6a 100644 --- a/src/include/c/isvd/la/vsl/driver.h +++ b/src/include/c/isvd/la/vsl/driver.h @@ -16,7 +16,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_la_vsl_driver_module @@ -26,7 +26,7 @@ void isvd_vsRngGaussianDriver( const INT seed, const INT nskip, const INT n, REA void isvd_vdRngGaussianDriver( const INT seed, const INT nskip, const INT n, REAL8 *r, const REAL8 a, const REAL8 sigma ); //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/la/vsl/service.h b/src/include/c/isvd/la/vsl/service.h index 05139de..134c34d 100644 --- a/src/include/c/isvd/la/vsl/service.h +++ b/src/include/c/isvd/la/vsl/service.h @@ -15,7 +15,7 @@ extern "C" { #endif // __cplusplus -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ typedef INT* isvd_VSLStreamStatePtr; @@ -34,7 +34,7 @@ void isvd_vslDeleteStream( isvd_VSLStreamStatePtr *streamp ); /// \brief Initializes the stream by the skip-ahead method. void isvd_vslSkipAheadStream( isvd_VSLStreamStatePtr stream, const INT nskip ); -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/util/io.h b/src/include/c/isvd/util/io.h index bb270ac..892ebc7 100644 --- a/src/include/c/isvd/util/io.h +++ b/src/include/c/isvd/util/io.h @@ -15,9 +15,13 @@ extern "C" { #endif // __cplusplus -void isvd_ifget( FILE *stream, isvd_int_t *varp ); -void isvd_sfget( FILE *stream, float *varp ); -void isvd_dfget( FILE *stream, double *varp ); +@ISVD_TYPE_MACRO_DEFINE@ + +void isvd_ifget( FILE *stream, INT *varp ); +void isvd_sfget( FILE *stream, REAL4 *varp ); +void isvd_dfget( FILE *stream, REAL8 *varp ); + +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/util/memory.h b/src/include/c/isvd/util/memory.h index c238b9e..cd1fa37 100644 --- a/src/include/c/isvd/util/memory.h +++ b/src/include/c/isvd/util/memory.h @@ -15,25 +15,29 @@ extern "C" { #endif // __cplusplus -isvd_int_t* isvd_imalloc( const size_t num ); -float* isvd_smalloc( const size_t num ); -double* isvd_dmalloc( const size_t num ); -_Complex float* isvd_cmalloc( const size_t num ); -_Complex double* isvd_zmalloc( const size_t num ); +@ISVD_TYPE_MACRO_DEFINE@ + +INT* isvd_imalloc( const size_t num ); +REAL4* isvd_smalloc( const size_t num ); +REAL8* isvd_dmalloc( const size_t num ); +COMP4* isvd_cmalloc( const size_t num ); +COMP8* isvd_zmalloc( const size_t num ); void isvd_free( void *ptr ); -void isvd_imemset0( isvd_int_t *ptr, const size_t num ); -void isvd_smemset0( float *ptr, const size_t num ); -void isvd_dmemset0( double *ptr, const size_t num ); -void isvd_cmemset0( _Complex float *ptr, const size_t num ); -void isvd_zmemset0( _Complex double *ptr, const size_t num ); - -void isvd_imemcpy( isvd_int_t *dst, const isvd_int_t *src, const size_t num ); -void isvd_smemcpy( float *dst, const float *src, const size_t num ); -void isvd_dmemcpy( double *dst, const double *src, const size_t num ); -void isvd_cmemcpy( _Complex float *dst, const _Complex float *src, const size_t num ); -void isvd_zmemcpy( _Complex double *dst, const _Complex double *src, const size_t num ); +void isvd_imemset0( INT *ptr, const size_t num ); +void isvd_smemset0( REAL4 *ptr, const size_t num ); +void isvd_dmemset0( REAL8 *ptr, const size_t num ); +void isvd_cmemset0( COMP4 *ptr, const size_t num ); +void isvd_zmemset0( COMP8 *ptr, const size_t num ); + +void isvd_imemcpy( INT *dst, const INT *src, const size_t num ); +void isvd_smemcpy( REAL4 *dst, const REAL4 *src, const size_t num ); +void isvd_dmemcpy( REAL8 *dst, const REAL8 *src, const size_t num ); +void isvd_cmemcpy( COMP4 *dst, const COMP4 *src, const size_t num ); +void isvd_zmemcpy( COMP8 *dst, const COMP8 *src, const size_t num ); + +@ISVD_TYPE_MACRO_UNDEF@ #if defined(__cplusplus) } diff --git a/src/include/c/isvd/util/mpi.h b/src/include/c/isvd/util/mpi.h index 8655673..54da529 100644 --- a/src/include/c/isvd/util/mpi.h +++ b/src/include/c/isvd/util/mpi.h @@ -15,6 +15,18 @@ extern "C" { #endif // __cplusplus +#if !defined(DOXYGEN_SHOULD_SKIP_THIS) +#if !defined(ISVD_USE_ILP64) +#define MPI_ISVD_INT_T MPI_INTEGER4 +#else // ISVD_USE_ILP64 +#define MPI_ISVD_INT_T MPI_INTEGER8 +#endif // ISVD_USE_ILP64 +#define MPI_ISVD_S_VAL_T MPI_REAL4 +#define MPI_ISVD_D_VAL_T MPI_REAL8 +#define MPI_ISVD_C_VAL_T MPI_COMPLEX8 +#define MPI_ISVD_Z_VAL_T MPI_COMPLEX16 +#endif // DOXYGEN_SHOULD_SKIP_THIS + mpi_int_t isvd_getMpiSize( const isvd_MpiComm comm ); mpi_int_t isvd_getMpiRank( const isvd_MpiComm comm ); diff --git a/src/lib/libisvd/core/driver/@x@_isvd.c b/src/lib/libisvd/core/driver/@x@_isvd.c index 82bce7e..e1174f3 100644 --- a/src/lib/libisvd/core/driver/@x@_isvd.c +++ b/src/lib/libisvd/core/driver/@x@_isvd.c @@ -100,35 +100,35 @@ /// \see isvd_Param /// void isvd_@x@Isvd( - const char *alg_s, - const char *alg_o, - const char *alg_i, - const char *alg_p, - const isvd_int_t m, - const isvd_int_t n, - const isvd_int_t k, - const isvd_int_t p, - const isvd_int_t N, - const @xtype@ *argv[4], - const isvd_int_t argc[4], - @xtype@ *retv[4], - const isvd_int_t retc[4], - double time[4], + const char *alg_s, + const char *alg_o, + const char *alg_i, + const char *alg_p, + const isvd_int_t m, + const isvd_int_t n, + const isvd_int_t k, + const isvd_int_t p, + const isvd_int_t N, + const @xtype_____@ *argv[4], + const isvd_int_t argc[4], + @xtype_____@ *retv[4], + const isvd_int_t retc[4], + double time[4], FILE *stream, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - @xtype@ *vt, - const isvd_int_t ldvt, - const isvd_int_t seed, - const mpi_int_t ut_root, - const mpi_int_t vt_root, - const mpi_int_t mpi_root, - const isvd_MpiComm mpi_comm + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const isvd_int_t seed, + const mpi_int_t ut_root, + const mpi_int_t vt_root, + const mpi_int_t mpi_root, + const isvd_MpiComm mpi_comm ) { const mpi_int_t mpi_rank = isvd_getMpiRank(MPI_COMM_WORLD); @@ -164,25 +164,25 @@ void isvd_@x@Isvd( // ====================================================================================================================== // // Gets arguments and return values of stages - const @xtype@ *argv_s = (argv != NULL) ? argv[0] : NULL; - const @xtype@ *argv_o = (argv != NULL) ? argv[1] : NULL; - const @xtype@ *argv_i = (argv != NULL) ? argv[2] : NULL; - const @xtype@ *argv_p = (argv != NULL) ? argv[3] : NULL; + const @xtype_____@ *argv_s = (argv != NULL) ? argv[0] : NULL; + const @xtype_____@ *argv_o = (argv != NULL) ? argv[1] : NULL; + const @xtype_____@ *argv_i = (argv != NULL) ? argv[2] : NULL; + const @xtype_____@ *argv_p = (argv != NULL) ? argv[3] : NULL; - const isvd_int_t argc_s = (argv != NULL) ? argc[0] : 0; - const isvd_int_t argc_o = (argv != NULL) ? argc[1] : 0; - const isvd_int_t argc_i = (argv != NULL) ? argc[2] : 0; - const isvd_int_t argc_p = (argv != NULL) ? argc[3] : 0; + const isvd_int_t argc_s = (argv != NULL) ? argc[0] : 0; + const isvd_int_t argc_o = (argv != NULL) ? argc[1] : 0; + const isvd_int_t argc_i = (argv != NULL) ? argc[2] : 0; + const isvd_int_t argc_p = (argv != NULL) ? argc[3] : 0; - @xtype@ *retv_s = (retv != NULL) ? retv[0] : NULL; - @xtype@ *retv_o = (retv != NULL) ? retv[1] : NULL; - @xtype@ *retv_i = (retv != NULL) ? retv[2] : NULL; - @xtype@ *retv_p = (retv != NULL) ? retv[3] : NULL; + @xtype_____@ *retv_s = (retv != NULL) ? retv[0] : NULL; + @xtype_____@ *retv_o = (retv != NULL) ? retv[1] : NULL; + @xtype_____@ *retv_i = (retv != NULL) ? retv[2] : NULL; + @xtype_____@ *retv_p = (retv != NULL) ? retv[3] : NULL; - const isvd_int_t retc_s = (retv != NULL) ? retc[0] : 0; - const isvd_int_t retc_o = (retv != NULL) ? retc[1] : 0; - const isvd_int_t retc_i = (retv != NULL) ? retc[2] : 0; - const isvd_int_t retc_p = (retv != NULL) ? retc[3] : 0; + const isvd_int_t retc_s = (retv != NULL) ? retc[0] : 0; + const isvd_int_t retc_o = (retv != NULL) ? retc[1] : 0; + const isvd_int_t retc_i = (retv != NULL) ? retc[2] : 0; + const isvd_int_t retc_p = (retv != NULL) ? retc[3] : 0; // ====================================================================================================================== // // Check stage arguments @@ -234,10 +234,10 @@ void isvd_@x@Isvd( // ====================================================================================================================== // // Allocate memory - @xtype@ *yst = isvd_@x@malloc(Nl * mb); + @xtype_____@ *yst = isvd_@x@malloc(Nl * mb); isvd_int_t ldyst = Nl; - @xtype@ *qt = isvd_@x@malloc(l * mb); + @xtype_____@ *qt = isvd_@x@malloc(l * mb); isvd_int_t ldqt = l; // ====================================================================================================================== // diff --git a/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c b/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c index cc2075c..9488538 100644 --- a/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_hierarchical_reduction.c @@ -10,6 +10,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module @@ -30,15 +31,15 @@ /// the routine only returns the first \b retc default arguments in \b retv. /// void isvd_@x@IntegrateHierarchicalReduction( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - @xtype@ *yst, - const isvd_int_t ldyst, - @xtype@ *qt, - const isvd_int_t ldqt + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + @xtype_____@ *yst, + const isvd_int_t ldyst, + @xtype_____@ *qt, + const isvd_int_t ldqt ) { if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } @@ -61,21 +62,21 @@ void isvd_@x@IntegrateHierarchicalReduction( // ====================================================================================================================== // // Allocate memory - @xtype@ *qst = yst; + @xtype_____@ *qst = yst; isvd_int_t ldqst = ldyst; // matrix B - @xtype@ *bs = isvd_@x@malloc(l * l * (N+1)/2); + @xtype_____@ *bs = isvd_@x@malloc(l * l * (N+1)/2); isvd_int_t ldbs = l; // matrix T - @xtype@ *tt = isvd_@x@malloc(l * l); + @xtype_____@ *tt = isvd_@x@malloc(l * l); isvd_int_t ldtt = l; // vector s - @xtype@ *s = isvd_@x@malloc(l); + @xtype_____@ *s = isvd_@x@malloc(l); - @xtype@ *tmpt = qt; + @xtype_____@ *tmpt = qt; isvd_int_t ldtmpt = ldqt; // ====================================================================================================================== // @@ -87,20 +88,20 @@ void isvd_@x@IntegrateHierarchicalReduction( for ( isvd_int_t i = 0; i < h; ++i ) { isvd_@x@Gemm('N', 'T', l, l, mj, 1.0, qst + i*l, ldqst, qst + (i+h)*l, ldqst, 0.0, bs + i*ldbs*l, ldbs); } - MPI_Allreduce(MPI_IN_PLACE, bs, ldbs*l*h, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, bs, ldbs*l*h, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); for ( isvd_int_t i = 0; i < h; ++i ) { // matrix W - @xtype@ *w = bs + i*ldbs*l; + @xtype_____@ *w = bs + i*ldbs*l; isvd_int_t ldw = ldbs; // matrix Q(i) - @xtype@ *qit = qst + i*l; + @xtype_____@ *qit = qst + i*l; isvd_int_t ldqit = ldqst; // matrix Q(i+h) - @xtype@ *qiht = qst + (i+h)*l; + @xtype_____@ *qiht = qst + (i+h)*l; isvd_int_t ldqiht = ldqst; // svd(B(i)) = W * S * T' diff --git a/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c b/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c index bd8327a..c5a1a0a 100644 --- a/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_kolmogorov_nagumo.c @@ -10,6 +10,7 @@ #include #include #include +#include #define kMaxit 256 #define kTol 1e-4 @@ -36,15 +37,15 @@ /// the routine only returns the first \b retc default arguments in \b retv. /// void isvd_@x@IntegrateKolmogorovNagumo( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const @xtype@ *yst, - const isvd_int_t ldyst, - @xtype@ *qt, - const isvd_int_t ldqt + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const @xtype_____@ *yst, + const isvd_int_t ldyst, + @xtype_____@ *qt, + const isvd_int_t ldqt ) { if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } @@ -65,7 +66,7 @@ void isvd_@x@IntegrateKolmogorovNagumo( isvd_int_t argi = -1; const isvd_int_t maxit = ( argc > ++argi ) ? argv[argi] : kMaxit; - const @xtype@ tol = ( argc > ++argi ) ? argv[argi] : kTol; + const @xtype_____@ tol = ( argc > ++argi ) ? argv[argi] : kTol; // ====================================================================================================================== // // Get parameters @@ -85,64 +86,64 @@ void isvd_@x@IntegrateKolmogorovNagumo( // ====================================================================================================================== // // Allocate memory - const @xtype@ *qst = yst; + const @xtype_____@ *qst = yst; isvd_int_t ldqst = ldyst; // matrix Qc' - @xtype@ *qct = isvd_@x@malloc(l * mj); + @xtype_____@ *qct = isvd_@x@malloc(l * mj); isvd_int_t ldqct = l; // matrix Q+' - @xtype@ *qpt = isvd_@x@malloc(l * mj); + @xtype_____@ *qpt = isvd_@x@malloc(l * mj); isvd_int_t ldqpt = l; // matrix Gc' - @xtype@ *gct = isvd_@x@malloc(l * mj); + @xtype_____@ *gct = isvd_@x@malloc(l * mj); isvd_int_t ldgct = l; // matrix Bc - @xtype@ *bc = isvd_@x@malloc(Nl * l); + @xtype_____@ *bc = isvd_@x@malloc(Nl * l); isvd_int_t ldbc = Nl; // matrix B+ - @xtype@ *bp = isvd_@x@malloc(Nl * l); + @xtype_____@ *bp = isvd_@x@malloc(Nl * l); isvd_int_t ldbp = Nl; // matrix Bgc - @xtype@ *bgc = isvd_@x@malloc(Nl * l); + @xtype_____@ *bgc = isvd_@x@malloc(Nl * l); isvd_int_t ldbgc = Nl; // matrix Dc - @xtype@ *dc = isvd_@x@malloc(l * l); + @xtype_____@ *dc = isvd_@x@malloc(l * l); isvd_int_t lddc = l; // matrix Z - @xtype@ *z = isvd_@x@malloc(l * l); + @xtype_____@ *z = isvd_@x@malloc(l * l); isvd_int_t ldz = l; // matrix C - @xtype@ *c = isvd_@x@malloc(l * l); + @xtype_____@ *c = isvd_@x@malloc(l * l); isvd_int_t ldc = l; // matrix inv(C) - @xtype@ *cinv = isvd_@x@malloc(l * l); + @xtype_____@ *cinv = isvd_@x@malloc(l * l); isvd_int_t ldcinv = l; // vector s - @xtype@ *s = isvd_@x@malloc(l * 2); + @xtype_____@ *s = isvd_@x@malloc(l * 2); // matrix Z * sqrt(S) - @xtype@ *zs = cinv; - isvd_int_t ldzs = ldcinv; + @xtype_____@ *zs = cinv; + isvd_int_t ldzs = ldcinv; // matrix Z / sqrt(S) - @xtype@ *zinvs = z; + @xtype_____@ *zinvs = z; isvd_int_t ldzinvs = ldz; // matrix sqrt(S) - @xtype@ *ss = s + l; + @xtype_____@ *ss = s + l; - @xtype@ *tmp; + @xtype_____@ *tmp; // ====================================================================================================================== // // Initializing @@ -152,13 +153,13 @@ void isvd_@x@IntegrateKolmogorovNagumo( // Bc := Qs' * Qc isvd_@x@Gemm('N', 'T', Nl, l, mj, 1.0, qst, ldqst, qct, ldqct, 0.0, bc, ldbc); - MPI_Allreduce(MPI_IN_PLACE, bc, ldbc*l, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, bc, ldbc*l, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // ====================================================================================================================== // // Iterating isvd_int_t iter; - @xtype@ error = -1.0/0.0; + @xtype_____@ error = -1.0/0.0; for ( iter = 1; ; ++iter ) { @@ -170,7 +171,7 @@ void isvd_@x@IntegrateKolmogorovNagumo( // Bgc := Qs' * Gc isvd_@x@Gemm('N', 'T', Nl, l, mj, 1.0, qst, ldqst, gct, ldgct, 0.0, bgc, ldbgc); - MPI_Allreduce(MPI_IN_PLACE, bgc, ldbgc*l, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, bgc, ldbgc*l, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // Dc := 1/N * Bc' * Bc isvd_@x@Gemm('T', 'N', l, l, Nl, 1.0/N, bc, ldbc, bc, ldbc, 0.0, dc, lddc); diff --git a/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c b/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c index d3e6745..6af8cce 100644 --- a/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c +++ b/src/lib/libisvd/core/stage/@x@_integrate_wen_yin.c @@ -10,6 +10,7 @@ #include #include #include +#include #define kMaxit 256 #define kTol 1e-3 @@ -50,15 +51,15 @@ /// the routine only returns the first \b retc default arguments in \b retv. /// void isvd_@x@IntegrateWenYin( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const @xtype@ *yst, - const isvd_int_t ldyst, - @xtype@ *qt, - const isvd_int_t ldqt + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const @xtype_____@ *yst, + const isvd_int_t ldyst, + @xtype_____@ *qt, + const isvd_int_t ldqt ) { if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } @@ -85,15 +86,15 @@ void isvd_@x@IntegrateWenYin( // Get arguments isvd_int_t argi = -1; - const isvd_int_t maxit = ( argc > ++argi ) ? argv[argi] : kMaxit; - const @xtype@ tol = ( argc > ++argi ) ? argv[argi] : kTol; - const @xtype@ tau0 = ( argc > ++argi ) ? argv[argi] : kTau0; - const @xtype@ taumax = ( argc > ++argi ) ? argv[argi] : kTaumax; - const @xtype@ taumin = ( argc > ++argi ) ? argv[argi] : kTaumin; - const isvd_int_t taumaxit = ( argc > ++argi ) ? argv[argi] : kTauMaxit; - const @xtype@ beta = ( argc > ++argi ) ? argv[argi] : kBeta; - const @xtype@ sigma = ( argc > ++argi ) ? argv[argi] : kSigma; - const @xtype@ eta = ( argc > ++argi ) ? argv[argi] : kEta; + const isvd_int_t maxit = ( argc > ++argi ) ? argv[argi] : kMaxit; + const @xtype_____@ tol = ( argc > ++argi ) ? argv[argi] : kTol; + const @xtype_____@ tau0 = ( argc > ++argi ) ? argv[argi] : kTau0; + const @xtype_____@ taumax = ( argc > ++argi ) ? argv[argi] : kTaumax; + const @xtype_____@ taumin = ( argc > ++argi ) ? argv[argi] : kTaumin; + const isvd_int_t taumaxit = ( argc > ++argi ) ? argv[argi] : kTauMaxit; + const @xtype_____@ beta = ( argc > ++argi ) ? argv[argi] : kBeta; + const @xtype_____@ sigma = ( argc > ++argi ) ? argv[argi] : kSigma; + const @xtype_____@ eta = ( argc > ++argi ) ? argv[argi] : kEta; // ====================================================================================================================== // // Get parameters @@ -121,74 +122,74 @@ void isvd_@x@IntegrateWenYin( // ====================================================================================================================== // // Allocate memory - const @xtype@ *qst = yst; + const @xtype_____@ *qst = yst; isvd_int_t ldqst = ldyst; // matrix Qc' - @xtype@ *qct = isvd_@x@malloc(l * mj); + @xtype_____@ *qct = isvd_@x@malloc(l * mj); isvd_int_t ldqct = l; // matrix Q+' - @xtype@ *qpt = isvd_@x@malloc(l * mj); + @xtype_____@ *qpt = isvd_@x@malloc(l * mj); isvd_int_t ldqpt = l; // matrix Gc' - @xtype@ *gct = isvd_@x@malloc(l * mj); + @xtype_____@ *gct = isvd_@x@malloc(l * mj); isvd_int_t ldgct = l; // matrix Xc' - @xtype@ *xct = isvd_@x@malloc(l * mj); + @xtype_____@ *xct = isvd_@x@malloc(l * mj); isvd_int_t ldxct = l; // matrix X+' - @xtype@ *xpt = isvd_@x@malloc(l * mj); + @xtype_____@ *xpt = isvd_@x@malloc(l * mj); isvd_int_t ldxpt = l; // matrix Bc - @xtype@ *bc = isvd_@x@malloc(Nl * l); + @xtype_____@ *bc = isvd_@x@malloc(Nl * l); isvd_int_t ldbc = Nl; // matrix B+ - @xtype@ *bp = isvd_@x@malloc(Nl * l); + @xtype_____@ *bp = isvd_@x@malloc(Nl * l); isvd_int_t ldbp = Nl; // matrix Bgc - @xtype@ *bgc = isvd_@x@malloc(Nl * l); + @xtype_____@ *bgc = isvd_@x@malloc(Nl * l); isvd_int_t ldbgc = Nl; // matrix Dc - @xtype@ *dc = isvd_@x@malloc(l * l); + @xtype_____@ *dc = isvd_@x@malloc(l * l); isvd_int_t lddc = l; // matrix Dgc - @xtype@ *dgc = isvd_@x@malloc(l * l); + @xtype_____@ *dgc = isvd_@x@malloc(l * l); isvd_int_t lddgc = l; // matrix C & inv(C) - @xtype@ *c = isvd_@x@malloc(l2 * l2); + @xtype_____@ *c = isvd_@x@malloc(l2 * l2); isvd_int_t ldc = l2; // matrix inv(C)_?? - @xtype@ *c11 = c; - @xtype@ *c21 = c + l; - @xtype@ *c12 = c + ldc*l; - @xtype@ *c22 = c + l + ldc*l; + @xtype_____@ *c11 = c; + @xtype_____@ *c21 = c + l; + @xtype_____@ *c12 = c + ldc*l; + @xtype_____@ *c22 = c + l + ldc*l; // matrix inv(C)_#? - @xtype@ *cs1 = c11; - @xtype@ *cs2 = c12; + @xtype_____@ *cs1 = c11; + @xtype_____@ *cs2 = c12; // matrix Fc - @xtype@ *fc = c21; + @xtype_____@ *fc = c21; isvd_int_t ldfc = ldc; // matrix Fgc - @xtype@ *fgc = c11; + @xtype_____@ *fgc = c11; isvd_int_t ldfgc = ldc; - @xtype@ *tmp; + @xtype_____@ *tmp; - @xtype@ taug, zeta, phi, mu; + @xtype_____@ taug, zeta, phi, mu; // ====================================================================================================================== // // Initializing @@ -198,7 +199,7 @@ void isvd_@x@IntegrateWenYin( // Bc := Qs' * Qc isvd_@x@Gemm('N', 'T', Nl, l, mj, 1.0, qst, ldqst, qct, ldqct, 0.0, bc, ldbc); - MPI_Allreduce(MPI_IN_PLACE, bc, ldbc*l, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, bc, ldbc*l, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // Dc := 1/N * Bc' * Bc isvd_@x@Gemm('T', 'N', l, l, Nl, 1.0/N, bc, ldbc, bc, ldbc, 0.0, dc, lddc); @@ -208,7 +209,7 @@ void isvd_@x@IntegrateWenYin( // Bgc := Qs' * Gc isvd_@x@Gemm('N', 'T', Nl, l, mj, 1.0, qst, ldqst, gct, ldgct, 0.0, bgc, ldbgc); - MPI_Allreduce(MPI_IN_PLACE, bgc, ldbgc*l, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, bgc, ldbgc*l, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // Dgc := 1/N * Bc' * Bgc isvd_@x@Gemm('T', 'N', l, l, Nl, 1.0/N, bc, ldbc, bgc, ldbgc, 0.0, dgc, lddgc); @@ -234,7 +235,7 @@ void isvd_@x@IntegrateWenYin( // ================================================================================================================== // // Find step size - @xtype@ tau = taug, phit = phi; + @xtype_____@ tau = taug, phit = phi; for ( isvd_int_t tauiter = 1; tauiter <= taumaxit; ++tauiter, tau *= beta ) { // C := [ Dc/2 - I/tau , I/2 ; @@ -295,7 +296,7 @@ void isvd_@x@IntegrateWenYin( // Bg+ [in Bgc] := Qs' * G+ [in Gc] isvd_@x@Gemm('N', 'T', Nl, l, mj, 1.0, qst, ldqst, gct, ldgct, 0.0, bgc, ldbgc); - MPI_Allreduce(MPI_IN_PLACE, bgc, ldbgc*l, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, bgc, ldbgc*l, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // Dg+ [in Dgc] := 1/N * B+' * Bg+ [in Bgc] isvd_@x@Gemm('T', 'N', l, l, Nl, 1.0/N, bp, ldbp, bgc, ldbgc, 0.0, dgc, lddgc); @@ -327,7 +328,7 @@ void isvd_@x@IntegrateWenYin( isvd_v@x@Sub(mj*ldxct, xct, xpt, xct); // Update taug - @xtype@ t[2]; + @xtype_____@ t[2]; if ( iter % 2 ) { t[0] = isvd_@x@Dot(mj*ldqct, qct, 1, qct, 1); @@ -337,7 +338,7 @@ void isvd_@x@IntegrateWenYin( t[1] = isvd_@x@Dot(mj*ldxct, xct, 1, xct, 1); } - MPI_Allreduce(MPI_IN_PLACE, t, 2, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, t, 2, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); taug = fabs(t[0]/t[1]); if ( taug < taumin ) { taug = taumin; } diff --git a/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c b/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c index 173301a..07d8591 100644 --- a/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c +++ b/src/lib/libisvd/core/stage/@x@_orthogonalize_gramian.c @@ -10,6 +10,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module @@ -27,13 +28,13 @@ /// the routine only returns the first \b retc default arguments in \b retv. /// void isvd_@x@OrthogonalizeGramian( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - @xtype@ *yst, - const isvd_int_t ldyst + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + @xtype_____@ *yst, + const isvd_int_t ldyst ) { if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } @@ -56,13 +57,13 @@ void isvd_@x@OrthogonalizeGramian( // ====================================================================================================================== // // Allocate memory - @xtype@ *yst_ = isvd_@x@malloc(ldyst * mj); + @xtype_____@ *yst_ = isvd_@x@malloc(ldyst * mj); isvd_int_t ldyst_ = ldyst; - @xtype@ *w = isvd_@x@malloc(l * Nl); + @xtype_____@ *w = isvd_@x@malloc(l * Nl); isvd_int_t ldw = l; - @xtype@ *s = isvd_@x@malloc(l * N); + @xtype_____@ *s = isvd_@x@malloc(l * N); isvd_int_t lds = l; // ====================================================================================================================== // @@ -72,7 +73,7 @@ void isvd_@x@OrthogonalizeGramian( for ( isvd_int_t i = 0; i < N; ++i ) { isvd_@x@Gemm('N', 'T', l, l, mj, 1.0, yst + i*l, ldyst, yst + i*l, ldyst, 0.0, w + i*ldw*l, ldw); } - MPI_Allreduce(MPI_IN_PLACE, w, ldw*Nl, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, w, ldw*Nl, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // eig(Wi) = Wi * Si^2 * Wi' for ( isvd_int_t i = 0; i < N; ++i ) { diff --git a/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c b/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c index 96f73c4..6df2d46 100644 --- a/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c +++ b/src/lib/libisvd/core/stage/@x@_orthogonalize_tall_skinny_qr.c @@ -10,6 +10,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_core_@x@_stage_module @@ -21,13 +22,13 @@ /// the routine only returns the first \b retc default arguments in \b retv. /// void isvd_@x@OrthogonalizeTallSkinnyQr( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - @xtype@ *yst, - const isvd_int_t ldyst + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + @xtype_____@ *yst, + const isvd_int_t ldyst ) { fprintf(stderr, "Tall-Skinny QR Orthogonalization is not implemented!\n"); diff --git a/src/lib/libisvd/core/stage/@x@_postprocess.h b/src/lib/libisvd/core/stage/@x@_postprocess.h index b183364..ffc9229 100644 --- a/src/lib/libisvd/core/stage/@x@_postprocess.h +++ b/src/lib/libisvd/core/stage/@x@_postprocess.h @@ -12,21 +12,22 @@ #include #include #include +#include #if !defined(DOXYGEN_SHOULD_SKIP_THIS) static void projectBlockCol( - const isvd_Param param, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *zt, - const isvd_int_t ldzt, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - const mpi_int_t ut_root + const isvd_Param param, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *zt, + const isvd_int_t ldzt, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + const mpi_int_t ut_root ) { ISVD_UNUSED(s); @@ -61,7 +62,7 @@ static void projectBlockCol( // ====================================================================================================================== // // Allocate memory - @xtype@ *qt_; + @xtype_____@ *qt_; if ( use_ut ) { qt_ = ut; } else { @@ -72,7 +73,7 @@ static void projectBlockCol( // ====================================================================================================================== // // Rearrange - MPI_Allgather(qt, mb*ldqt, MPI_@X_TYPE@, qt_, mb*ldqt, MPI_@X_TYPE@, param.mpi_comm); + MPI_Allgather(qt, mb*ldqt, MPI_@XTYPE@, qt_, mb*ldqt, MPI_@XTYPE@, param.mpi_comm); // ====================================================================================================================== // // Project @@ -91,18 +92,18 @@ static void projectBlockCol( } static void projectBlockRow( - const isvd_Param param, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *zt, - const isvd_int_t ldzt, - @xtype@ *s, - @xtype@ *vt, - const isvd_int_t ldvt, - const mpi_int_t vt_root + const isvd_Param param, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *zt, + const isvd_int_t ldzt, + @xtype_____@ *s, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const mpi_int_t vt_root ) { ISVD_UNUSED(s); @@ -137,7 +138,7 @@ static void projectBlockRow( // ====================================================================================================================== // // Allocate memory - @xtype@ *zt_; + @xtype_____@ *zt_; if ( use_vt ) { zt_ = vt; } else { @@ -155,7 +156,7 @@ static void projectBlockRow( // ====================================================================================================================== // // Rearrange - MPI_Reduce_scatter_block(zt_, zt, nb*ldzt, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Reduce_scatter_block(zt_, zt, nb*ldzt, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // ====================================================================================================================== // // Deallocate memory diff --git a/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c b/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c index 627dbac..f3ebb3d 100644 --- a/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_gramian.c @@ -57,24 +57,24 @@ /// the routine only returns the first \b retc default arguments in \b retv. /// void isvd_@x@PostprocessGramian( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - @xtype@ *vt, - const isvd_int_t ldvt, - const mpi_int_t ut_root, - const mpi_int_t vt_root + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const mpi_int_t ut_root, + const mpi_int_t vt_root ) { if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } @@ -113,10 +113,10 @@ void isvd_@x@PostprocessGramian( // ====================================================================================================================== // // Allocate memory - @xtype@ *zt = isvd_@x@malloc(l * nb); + @xtype_____@ *zt = isvd_@x@malloc(l * nb); isvd_int_t ldzt = l; - @xtype@ *w = isvd_@x@malloc(l * l); + @xtype_____@ *w = isvd_@x@malloc(l * l); isvd_int_t ldw = l; // ====================================================================================================================== // @@ -133,7 +133,7 @@ void isvd_@x@PostprocessGramian( // W := Z' * Z isvd_@x@Gemm('N', 'T', l, l, nj, 1.0, zt, ldzt, zt, ldzt, 0.0, w, ldw); - MPI_Allreduce(MPI_IN_PLACE, w, ldw*l, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, w, ldw*l, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // eig(W) = W * S^2 * W' const char jobw_ = (ut_root >= -1 || vt_root >= -1) ? 'O' : 'N'; @@ -149,9 +149,9 @@ void isvd_@x@PostprocessGramian( if ( ut_root >= 0 ) { if ( param.mpi_rank == ut_root ) { - MPI_Gather(MPI_IN_PLACE, mb*ldut, MPI_@X_TYPE@, ut, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); + MPI_Gather(MPI_IN_PLACE, mb*ldut, MPI_@XTYPE@, ut, mb*ldut, MPI_@XTYPE@, ut_root, param.mpi_comm); } else { - MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, NULL, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); + MPI_Gather(ut, mb*ldut, MPI_@XTYPE@, NULL, mb*ldut, MPI_@XTYPE@, ut_root, param.mpi_comm); } } } @@ -163,9 +163,9 @@ void isvd_@x@PostprocessGramian( if ( vt_root >= 0 ) { if ( param.mpi_rank == vt_root ) { - MPI_Gather(MPI_IN_PLACE, nb*ldvt, MPI_@X_TYPE@, vt, nb*ldvt, MPI_@X_TYPE@, vt_root, param.mpi_comm); + MPI_Gather(MPI_IN_PLACE, nb*ldvt, MPI_@XTYPE@, vt, nb*ldvt, MPI_@XTYPE@, vt_root, param.mpi_comm); } else { - MPI_Gather(vt, nb*ldvt, MPI_@X_TYPE@, NULL, nb*ldvt, MPI_@X_TYPE@, vt_root, param.mpi_comm); + MPI_Gather(vt, nb*ldvt, MPI_@XTYPE@, NULL, nb*ldvt, MPI_@XTYPE@, vt_root, param.mpi_comm); } } } diff --git a/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c b/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c index df8c7df..c34828c 100644 --- a/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_symmetric.c @@ -57,24 +57,24 @@ /// \note The result of 𝑼 and 𝑽 are the same. /// void isvd_@x@PostprocessSymmetric( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - @xtype@ *vt, - const isvd_int_t ldvt, - const mpi_int_t ut_root, - const mpi_int_t vt_root + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const mpi_int_t ut_root, + const mpi_int_t vt_root ) { if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } @@ -117,10 +117,10 @@ void isvd_@x@PostprocessSymmetric( // ====================================================================================================================== // // Allocate memory - @xtype@ *zt = isvd_@x@malloc(l * nb); + @xtype_____@ *zt = isvd_@x@malloc(l * nb); isvd_int_t ldzt = l; - @xtype@ *w = isvd_@x@malloc(l * l); + @xtype_____@ *w = isvd_@x@malloc(l * l); isvd_int_t ldw = l; // ====================================================================================================================== // @@ -137,7 +137,7 @@ void isvd_@x@PostprocessSymmetric( // W := Z' * Q isvd_@x@Gemmt('U', 'N', 'T', l, nj, 1.0, zt, ldzt, qt, ldqt, 0.0, w, ldw); - MPI_Allreduce(MPI_IN_PLACE, w, ldw*l, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Allreduce(MPI_IN_PLACE, w, ldw*l, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // eig(W) = W * S * W' const char jobw_ = (ut_root >= -1) ? 'V' : 'N'; @@ -152,9 +152,9 @@ void isvd_@x@PostprocessSymmetric( if ( ut_root >= 0 ) { if ( param.mpi_rank == ut_root ) { - MPI_Gather(MPI_IN_PLACE, mb*ldut, MPI_@X_TYPE@, ut, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); + MPI_Gather(MPI_IN_PLACE, mb*ldut, MPI_@XTYPE@, ut, mb*ldut, MPI_@XTYPE@, ut_root, param.mpi_comm); } else { - MPI_Gather(ut, mb*ldut, MPI_@X_TYPE@, NULL, mb*ldut, MPI_@X_TYPE@, ut_root, param.mpi_comm); + MPI_Gather(ut, mb*ldut, MPI_@XTYPE@, NULL, mb*ldut, MPI_@XTYPE@, ut_root, param.mpi_comm); } } } diff --git a/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c b/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c index a0f0158..3276561 100644 --- a/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c +++ b/src/lib/libisvd/core/stage/@x@_postprocess_tall_skinny_qr.c @@ -23,24 +23,24 @@ /// the routine only returns the first \b retc default arguments in \b retv. /// void isvd_@x@PostprocessTallSkinnyQr( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - @xtype@ *vt, - const isvd_int_t ldvt, - const mpi_int_t ut_root, - const mpi_int_t vt_root + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const mpi_int_t ut_root, + const mpi_int_t vt_root ) { fprintf(stderr, "Tall-Skinny QR Postprocessing is not implemented!\n"); diff --git a/src/lib/libisvd/core/stage/@x@_sketch.h b/src/lib/libisvd/core/stage/@x@_sketch.h index 65a9727..a8a61ba 100644 --- a/src/lib/libisvd/core/stage/@x@_sketch.h +++ b/src/lib/libisvd/core/stage/@x@_sketch.h @@ -13,18 +13,19 @@ #include #include #include +#include #include #if !defined(DOXYGEN_SHOULD_SKIP_THIS) static void sketchBlockCol( - const isvd_Param param, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - @xtype@ *yst, - const isvd_int_t ldyst, - const isvd_int_t seed, - const mpi_int_t mpi_root + const isvd_Param param, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + @xtype_____@ *yst, + const isvd_int_t ldyst, + const isvd_int_t seed, + const mpi_int_t mpi_root ) { ISVD_UNUSED(ldyst); @@ -52,10 +53,10 @@ static void sketchBlockCol( // ====================================================================================================================== // // Allocate memory - @xtype@ *omegat = isvd_@x@malloc(Nl * nj); + @xtype_____@ *omegat = isvd_@x@malloc(Nl * nj); isvd_int_t ldomegat = Nl; - @xtype@ *yst_ = isvd_@x@malloc(Nl * Pmb); + @xtype_____@ *yst_ = isvd_@x@malloc(Nl * Pmb); isvd_int_t ldyst_ = Nl; // ====================================================================================================================== // @@ -75,7 +76,7 @@ static void sketchBlockCol( // ====================================================================================================================== // // Rearrange - MPI_Reduce_scatter_block(yst_, yst, mb*ldyst_, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Reduce_scatter_block(yst_, yst, mb*ldyst_, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // ====================================================================================================================== // // Deallocate memory @@ -86,14 +87,14 @@ static void sketchBlockCol( } static void sketchBlockRow( - const isvd_Param param, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - @xtype@ *yst, - const isvd_int_t ldyst, - const isvd_int_t seed, - const mpi_int_t mpi_root + const isvd_Param param, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + @xtype_____@ *yst, + const isvd_int_t ldyst, + const isvd_int_t seed, + const mpi_int_t mpi_root ) { // ====================================================================================================================== // @@ -116,7 +117,7 @@ static void sketchBlockRow( // ====================================================================================================================== // // Allocate memory - @xtype@ *omegat = isvd_@x@malloc(Nl * n); + @xtype_____@ *omegat = isvd_@x@malloc(Nl * n); isvd_int_t ldomegat = Nl; // ====================================================================================================================== // diff --git a/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c b/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c index 912ba9d..8e9ffc1 100644 --- a/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c +++ b/src/lib/libisvd/core/stage/@x@_sketch_gaussian_projection.c @@ -41,19 +41,19 @@ /// the routine only returns the first \b retc default arguments in \b retv. /// void isvd_@x@SketchGaussianProjection( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - @xtype@ *yst, - const isvd_int_t ldyst, - const isvd_int_t seed, - const mpi_int_t mpi_root + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + @xtype_____@ *yst, + const isvd_int_t ldyst, + const isvd_int_t seed, + const mpi_int_t mpi_root ) { if ( argc > 0 ) { isvd_assert_ne(argv, nullptr); } diff --git a/src/lib/libisvd/gpu/stage/@x@_postprocess_gpu.h b/src/lib/libisvd/gpu/stage/@x@_postprocess_gpu.h index 6edb0e9..9120fd6 100644 --- a/src/lib/libisvd/gpu/stage/@x@_postprocess_gpu.h +++ b/src/lib/libisvd/gpu/stage/@x@_postprocess_gpu.h @@ -21,21 +21,22 @@ #include #include #include +#include #if !defined(DOXYGEN_SHOULD_SKIP_THIS) static void projectBlockCol( - const isvd_Param param, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *zt, - const isvd_int_t ldzt, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - const mpi_int_t ut_root + const isvd_Param param, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *zt, + const isvd_int_t ldzt, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + const mpi_int_t ut_root ) { ISVD_UNUSED(s); @@ -73,21 +74,21 @@ static void projectBlockCol( size_t free_byte, total_byte; cudaMemGetInfo(&free_byte, &total_byte); if ( isvd_gpu_memory_limit > 0 ) free_byte = minl(free_byte, isvd_gpu_memory_limit); - size_t melem = free_byte / sizeof(@xtype@); + size_t melem = free_byte / sizeof(@xtype_____@); size_t nelem_used = m * l; isvd_int_t n_gpu = (melem - nelem_used) / (m + l); if ( n_gpu > (isvd_int_t)isvd_kBlockSizeGpu ) n_gpu = (n_gpu / isvd_kBlockSizeGpu) * isvd_kBlockSizeGpu; n_gpu = min(n_gpu, nj); if ( n_gpu <= 0 ) { fprintf(stderr, "No enough GPU memory. (Request at least %" PRId64 " bytes. Only %" PRId64 " bytes free.", - nelem_used * sizeof(@xtype@), melem * sizeof(@xtype@)); + nelem_used * sizeof(@xtype_____@), melem * sizeof(@xtype_____@)); isvd_assert_fail(); } // ====================================================================================================================== // // Allocate memory - @xtype@ *qt_; + @xtype_____@ *qt_; if ( use_ut ) { qt_ = ut; } else { @@ -95,22 +96,22 @@ static void projectBlockCol( } isvd_int_t ldqt_ = l; - @xtype@ *a_gpu; + @xtype_____@ *a_gpu; magma_@x@malloc(&a_gpu, m * n_gpu); isvd_int_t lda_gpu = (ordera == 'C') ? m : n_gpu; - @xtype@ *qt_gpu; + @xtype_____@ *qt_gpu; magma_@x@malloc(&qt_gpu, l * m); isvd_int_t ldqt_gpu = l; - @xtype@ *zt_gpu; + @xtype_____@ *zt_gpu; magma_@x@malloc(&zt_gpu, l * n_gpu); isvd_int_t ldzt_gpu = l; // ====================================================================================================================== // // Rearrange - MPI_Allgather(qt, mb*ldqt, MPI_@X_TYPE@, qt_, mb*ldqt, MPI_@X_TYPE@, param.mpi_comm); + MPI_Allgather(qt, mb*ldqt, MPI_@XTYPE@, qt_, mb*ldqt, MPI_@XTYPE@, param.mpi_comm); // ====================================================================================================================== // // Send data @@ -124,8 +125,8 @@ static void projectBlockCol( isvd_int_t idx; for ( idx = 0; idx < nj; idx += n_gpu ) { - const @xtype@ *a_tmp = (ordera == 'C') ? (a + lda*idx) : (a+idx); - @xtype@ *zt_tmp = zt + ldzt*idx; + const @xtype_____@ *a_tmp = (ordera == 'C') ? (a + lda*idx) : (a+idx); + @xtype_____@ *zt_tmp = zt + ldzt*idx; const isvd_int_t n_tmp = min(n_gpu, nj-idx); // Send A @@ -157,18 +158,18 @@ static void projectBlockCol( } static void projectBlockRow( - const isvd_Param param, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *zt, - const isvd_int_t ldzt, - @xtype@ *s, - @xtype@ *vt, - const isvd_int_t ldvt, - const mpi_int_t vt_root + const isvd_Param param, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *zt, + const isvd_int_t ldzt, + @xtype_____@ *s, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const mpi_int_t vt_root ) { ISVD_UNUSED(s); @@ -205,21 +206,21 @@ static void projectBlockRow( size_t free_byte, total_byte; cudaMemGetInfo(&free_byte, &total_byte); - size_t melem = free_byte / sizeof(@xtype@); + size_t melem = free_byte / sizeof(@xtype_____@); size_t nelem_used = mj * l; isvd_int_t n_gpu = (melem - nelem_used) / (mj + l); if ( n_gpu > (isvd_int_t)isvd_kBlockSizeGpu ) n_gpu = (n_gpu / isvd_kBlockSizeGpu) * isvd_kBlockSizeGpu; n_gpu = min(n_gpu, n); if ( n_gpu <= 0 ) { fprintf(stderr, "No enough GPU memory. (Request at least %" PRId64 " bytes. Only %" PRId64 " bytes free.", - nelem_used * sizeof(@xtype@), melem * sizeof(@xtype@)); + nelem_used * sizeof(@xtype_____@), melem * sizeof(@xtype_____@)); isvd_assert_fail(); } // ====================================================================================================================== // // Allocate memory - @xtype@ *zt_; + @xtype_____@ *zt_; if ( use_vt ) { zt_ = vt; } else { @@ -227,15 +228,15 @@ static void projectBlockRow( } isvd_int_t ldzt_ = l; - @xtype@ *a_gpu; + @xtype_____@ *a_gpu; magma_@x@malloc(&a_gpu, mj * n_gpu); isvd_int_t lda_gpu = (ordera == 'C') ? mj : n_gpu; - @xtype@ *qt_gpu; + @xtype_____@ *qt_gpu; magma_@x@malloc(&qt_gpu, l * mj); isvd_int_t ldqt_gpu = l; - @xtype@ *zt_gpu; + @xtype_____@ *zt_gpu; magma_@x@malloc(&zt_gpu, l * n_gpu); isvd_int_t ldzt_gpu = l; @@ -251,8 +252,8 @@ static void projectBlockRow( isvd_int_t idx; for ( idx = 0; idx < n; idx += n_gpu ) { - const @xtype@ *a_tmp = (ordera == 'C') ? (a + lda*idx) : (a+idx); - @xtype@ *zt_tmp = zt_ + ldzt*idx; + const @xtype_____@ *a_tmp = (ordera == 'C') ? (a + lda*idx) : (a+idx); + @xtype_____@ *zt_tmp = zt_ + ldzt*idx; const isvd_int_t n_tmp = min(n_gpu, n-idx); // Send A @@ -273,7 +274,7 @@ static void projectBlockRow( // ====================================================================================================================== // // Rearrange - MPI_Reduce_scatter_block(zt_, zt, nb*ldzt, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Reduce_scatter_block(zt_, zt, nb*ldzt, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // ====================================================================================================================== // // Deallocate memory diff --git a/src/lib/libisvd/gpu/stage/@x@_sketch_gpu.h b/src/lib/libisvd/gpu/stage/@x@_sketch_gpu.h index 3863787..10bc0a4 100644 --- a/src/lib/libisvd/gpu/stage/@x@_sketch_gpu.h +++ b/src/lib/libisvd/gpu/stage/@x@_sketch_gpu.h @@ -21,18 +21,19 @@ #include #include #include +#include #include #if !defined(DOXYGEN_SHOULD_SKIP_THIS) static void sketchBlockCol( - const isvd_Param param, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - @xtype@ *yst, - const isvd_int_t ldyst, - const isvd_int_t seed, - const mpi_int_t mpi_root + const isvd_Param param, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + @xtype_____@ *yst, + const isvd_int_t ldyst, + const isvd_int_t seed, + const mpi_int_t mpi_root ) { ISVD_UNUSED(ldyst); @@ -63,35 +64,35 @@ static void sketchBlockCol( size_t free_byte, total_byte; cudaMemGetInfo(&free_byte, &total_byte); if ( isvd_gpu_memory_limit > 0 ) free_byte = minl(free_byte, isvd_gpu_memory_limit); - size_t melem = free_byte / sizeof(@xtype@); + size_t melem = free_byte / sizeof(@xtype_____@); size_t nelem_used = m * Nl; isvd_int_t n_gpu = (melem - nelem_used) / (m + Nl); if ( n_gpu > (isvd_int_t)isvd_kBlockSizeGpu ) n_gpu = (n_gpu / isvd_kBlockSizeGpu) * isvd_kBlockSizeGpu; n_gpu = min(n_gpu, nj); if ( n_gpu <= 0 ) { fprintf(stderr, "No enough GPU memory. (Request at least %" PRId64 " bytes. Only %" PRId64 " bytes free.", - nelem_used * sizeof(@xtype@), melem * sizeof(@xtype@)); + nelem_used * sizeof(@xtype_____@), melem * sizeof(@xtype_____@)); isvd_assert_fail(); } // ====================================================================================================================== // // Allocate memory - @xtype@ *omegat = isvd_@x@malloc(Nl * nj); + @xtype_____@ *omegat = isvd_@x@malloc(Nl * nj); isvd_int_t ldomegat = Nl; - @xtype@ *yst_ = isvd_@x@malloc(Nl * Pmb); + @xtype_____@ *yst_ = isvd_@x@malloc(Nl * Pmb); isvd_int_t ldyst_ = Nl; - @xtype@ *a_gpu; + @xtype_____@ *a_gpu; magma_@x@malloc(&a_gpu, m * n_gpu); isvd_int_t lda_gpu = (ordera == 'C') ? m : n_gpu; - @xtype@ *omegat_gpu; + @xtype_____@ *omegat_gpu; magma_@x@malloc(&omegat_gpu, Nl * n_gpu); isvd_int_t ldomegat_gpu = Nl; - @xtype@ *yst_gpu; + @xtype_____@ *yst_gpu; magma_@x@malloc(&yst_gpu, Nl * m); isvd_int_t ldyst_gpu = Nl; @@ -105,13 +106,13 @@ static void sketchBlockCol( // ====================================================================================================================== // // Project - cudaMemset(yst_gpu, 0, ldyst_gpu * m * sizeof(@xtype@)); + cudaMemset(yst_gpu, 0, ldyst_gpu * m * sizeof(@xtype_____@)); char transa_ = (ordera == 'C') ? 'T' : 'N'; isvd_int_t idx; for ( idx = 0; idx < nj; idx += n_gpu ) { - const @xtype@ *a_tmp = (ordera == 'C') ? (a + lda*idx) : (a+idx); - const @xtype@ *omegat_tmp = omegat + ldomegat*idx; + const @xtype_____@ *a_tmp = (ordera == 'C') ? (a + lda*idx) : (a+idx); + const @xtype_____@ *omegat_tmp = omegat + ldomegat*idx; const isvd_int_t n_tmp = min(n_gpu, nj-idx); // Send A and Omega @@ -135,7 +136,7 @@ static void sketchBlockCol( // ====================================================================================================================== // // Rearrange - MPI_Reduce_scatter_block(yst_, yst, mb*ldyst_, MPI_@X_TYPE@, MPI_SUM, param.mpi_comm); + MPI_Reduce_scatter_block(yst_, yst, mb*ldyst_, MPI_@XTYPE@, MPI_SUM, param.mpi_comm); // ====================================================================================================================== // // Deallocate memory @@ -149,14 +150,14 @@ static void sketchBlockCol( } static void sketchBlockRow( - const isvd_Param param, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - @xtype@ *yst, - const isvd_int_t ldyst, - const isvd_int_t seed, - const mpi_int_t mpi_root + const isvd_Param param, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + @xtype_____@ *yst, + const isvd_int_t ldyst, + const isvd_int_t seed, + const mpi_int_t mpi_root ) { // ====================================================================================================================== // @@ -181,32 +182,32 @@ static void sketchBlockRow( size_t free_byte, total_byte; cudaMemGetInfo(&free_byte, &total_byte); - size_t melem = free_byte / sizeof(@xtype@); + size_t melem = free_byte / sizeof(@xtype_____@); size_t nelem_used = mj * Nl; isvd_int_t n_gpu = (melem - nelem_used) / (mj + Nl); if ( n_gpu > (isvd_int_t)isvd_kBlockSizeGpu ) n_gpu = (n_gpu / isvd_kBlockSizeGpu) * isvd_kBlockSizeGpu; n_gpu = min(n_gpu, n); if ( n_gpu <= 0 ) { fprintf(stderr, "No enough GPU memory. (Request at least %" PRId64 " bytes. Only %" PRId64 " bytes free.", - nelem_used * sizeof(@xtype@), melem * sizeof(@xtype@)); + nelem_used * sizeof(@xtype_____@), melem * sizeof(@xtype_____@)); isvd_assert_fail(); } // ====================================================================================================================== // // Allocate memory - @xtype@ *omegat = isvd_@x@malloc(n * Nl); + @xtype_____@ *omegat = isvd_@x@malloc(n * Nl); isvd_int_t ldomegat = Nl; - @xtype@ *a_gpu; + @xtype_____@ *a_gpu; magma_@x@malloc(&a_gpu, mj * n_gpu); isvd_int_t lda_gpu = (ordera == 'C') ? mj : n_gpu; - @xtype@ *omegat_gpu; + @xtype_____@ *omegat_gpu; magma_@x@malloc(&omegat_gpu, Nl * n_gpu); isvd_int_t ldomegat_gpu = Nl; - @xtype@ *yst_gpu; + @xtype_____@ *yst_gpu; magma_@x@malloc(&yst_gpu, Nl * mj); isvd_int_t ldyst_gpu = Nl; @@ -220,13 +221,13 @@ static void sketchBlockRow( // ====================================================================================================================== // // Project - cudaMemset(yst_gpu, 0, ldyst_gpu * mj * sizeof(@xtype@)); + cudaMemset(yst_gpu, 0, ldyst_gpu * mj * sizeof(@xtype_____@)); char transa_ = (ordera == 'C') ? 'T' : 'N'; isvd_int_t idx; for ( idx = 0; idx < n; idx += n_gpu ) { - const @xtype@ *a_tmp = (ordera == 'C') ? (a + lda*idx) : (a+idx); - const @xtype@ *omegat_tmp = omegat + ldomegat*idx; + const @xtype_____@ *a_tmp = (ordera == 'C') ? (a + lda*idx) : (a+idx); + const @xtype_____@ *omegat_tmp = omegat + ldomegat*idx; const isvd_int_t n_tmp = min(n_gpu, n-idx); // Send A and Omega diff --git a/src/lib/libisvd/la/blas/dimm.c b/src/lib/libisvd/la/blas/dimm.c index 237eddd..027b903 100644 --- a/src/lib/libisvd/la/blas/dimm.c +++ b/src/lib/libisvd/la/blas/dimm.c @@ -11,7 +11,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #define isvd_xDimm( side, m, n, alpha, a, b, ldb, xScal, xMul ) \ const char side_ = isvd_arg2char("SIDE", side, "LR", NULL); \ @@ -48,4 +48,4 @@ void isvd_zDimm( const CHAR1 side, const INT m, const INT n, const COMP8 alpha, const COMP8 *a, COMP8 *b, const INT ldb ) { isvd_xDimm(side, m, n, alpha, a, b, ldb, isvd_zScal, isvd_vzMul); } -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/blas/dism.c b/src/lib/libisvd/la/blas/dism.c index 1cfa57c..36c34d6 100644 --- a/src/lib/libisvd/la/blas/dism.c +++ b/src/lib/libisvd/la/blas/dism.c @@ -11,7 +11,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #define isvd_xDism( side, m, n, alpha, a, b, ldb, xScal, xDiv ) \ const char side_ = isvd_arg2char("SIDE", side, "LR", NULL); \ @@ -48,4 +48,4 @@ void isvd_zDism( const CHAR1 side, const INT m, const INT n, const COMP8 alpha, const COMP8 *a, COMP8 *b, const INT ldb ) { isvd_xDism(side, m, n, alpha, a, b, ldb, isvd_zScal, isvd_vzDiv); } -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/blas/gemmt.c b/src/lib/libisvd/la/blas/gemmt.c index 5090093..00fbec8 100644 --- a/src/lib/libisvd/la/blas/gemmt.c +++ b/src/lib/libisvd/la/blas/gemmt.c @@ -10,7 +10,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -71,4 +71,4 @@ void isvd_zGemmt( #endif // ISVD_USE_MKL -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/blas/iamax.c b/src/lib/libisvd/la/blas/iamax.c index c98e3d1..254ed08 100644 --- a/src/lib/libisvd/la/blas/iamax.c +++ b/src/lib/libisvd/la/blas/iamax.c @@ -9,7 +9,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(__cplusplus) extern "C" { @@ -38,4 +38,4 @@ REAL8 isvd_dAmax( const INT n, const REAL8 *x, const INT incx ) { INT i = isvd_i COMP4 isvd_cAmax( const INT n, const COMP4 *x, const INT incx ) { INT i = isvd_icAmax(n, x, incx); return cabsf(x[i]); } COMP8 isvd_zAmax( const INT n, const COMP8 *x, const INT incx ) { INT i = isvd_izAmax(n, x, incx); return cabs(x[i]); } -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/blas/iamin.c b/src/lib/libisvd/la/blas/iamin.c index 28b586f..158543c 100644 --- a/src/lib/libisvd/la/blas/iamin.c +++ b/src/lib/libisvd/la/blas/iamin.c @@ -9,7 +9,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -62,4 +62,4 @@ REAL8 isvd_dAmin( const INT n, const REAL8 *x, const INT incx ) { INT i = isvd_i COMP4 isvd_cAmin( const INT n, const COMP4 *x, const INT incx ) { INT i = isvd_icAmin(n, x, incx); return cabsf(x[i]); } COMP8 isvd_zAmin( const INT n, const COMP8 *x, const INT incx ) { INT i = isvd_izAmin(n, x, incx); return cabs(x[i]); } -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/blas/omatcopy.c b/src/lib/libisvd/la/blas/omatcopy.c index 6d414d7..9d07df0 100644 --- a/src/lib/libisvd/la/blas/omatcopy.c +++ b/src/lib/libisvd/la/blas/omatcopy.c @@ -10,7 +10,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -46,8 +46,8 @@ void isvd_zOmatcopy( #else // ISVD_USE_MKL -static inline float rconjf( const float z ) { return z; } -static inline double rconj( const double z ) { return z; } +static inline REAL4 rconjf( const REAL4 z ) { return z; } +static inline REAL8 rconj( const REAL8 z ) { return z; } #define isvd_xOmatcopy( trans, m, n, alpha, a, lda, b, ldb, conj ) \ const char trans_ = isvd_arg2char("TRANS", trans, "NTRC", NULL); \ @@ -105,4 +105,4 @@ void isvd_zOmatcopy( #endif // ISVD_USE_MKL -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/def.h b/src/lib/libisvd/la/def.h index 3516ba2..917a707 100644 --- a/src/lib/libisvd/la/def.h +++ b/src/lib/libisvd/la/def.h @@ -41,8 +41,8 @@ extern "C" { #if defined(ISVD_USE_MKL) #define MKL_INT isvd_int_t #define MKL_UINT isvd_uint_t - #define MKL_Complex8 _Complex float - #define MKL_Complex16 _Complex double + #define MKL_Complex8 isvd_c_val_t + #define MKL_Complex16 isvd_z_val_t #endif // ISVD_USE_MKL #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/src/lib/libisvd/la/lapack/geinv.c b/src/lib/libisvd/la/lapack/geinv.c index 684b5fb..5050a11 100644 --- a/src/lib/libisvd/la/lapack/geinv.c +++ b/src/lib/libisvd/la/lapack/geinv.c @@ -10,7 +10,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if !defined(DOXYGEN_SHOULD_SKIP_THIS) @@ -91,4 +91,4 @@ void isvd_zGeinv( isvd_free(work); } -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/lapack/gesvd.c b/src/lib/libisvd/la/lapack/gesvd.c index 26786b0..11dad35 100644 --- a/src/lib/libisvd/la/lapack/gesvd.c +++ b/src/lib/libisvd/la/lapack/gesvd.c @@ -11,7 +11,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if !defined(DOXYGEN_SHOULD_SKIP_THIS) @@ -84,4 +84,4 @@ void isvd_zGesvd( } //\} -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/lapack/lsame.c b/src/lib/libisvd/la/lapack/lsame.c index dfd9b62..af68d7b 100644 --- a/src/lib/libisvd/la/lapack/lsame.c +++ b/src/lib/libisvd/la/lapack/lsame.c @@ -9,7 +9,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if !defined(DOXYGEN_SHOULD_SKIP_THIS) @@ -49,4 +49,4 @@ bool isvd_Lsamen( return true; } -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/lapack/syev.c b/src/lib/libisvd/la/lapack/syev.c index 9ad253b..2ed9691 100644 --- a/src/lib/libisvd/la/lapack/syev.c +++ b/src/lib/libisvd/la/lapack/syev.c @@ -10,7 +10,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if !defined(DOXYGEN_SHOULD_SKIP_THIS) @@ -78,4 +78,4 @@ void isvd_zSyev( isvd_free(rwork); } -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/util/memory.c b/src/lib/libisvd/la/util/memory.c index 1354157..bdba571 100644 --- a/src/lib/libisvd/la/util/memory.c +++ b/src/lib/libisvd/la/util/memory.c @@ -11,6 +11,8 @@ #include #include +@ISVD_TYPE_MACRO_DEFINE@ + #if defined(ISVD_USE_MKL) #define isvd_xmalloc( num, type ) (type*)(mkl_malloc(num * sizeof(type), 64)); #else // ISVD_USE_MKL @@ -26,24 +28,24 @@ /// \return The pointer to the array. /// //\{ -isvd_int_t* isvd_imalloc( const size_t num ) { - return isvd_xmalloc(num, isvd_int_t); +INT* isvd_imalloc( const size_t num ) { + return isvd_xmalloc(num, INT); } -float* isvd_smalloc( const size_t num ) { - return isvd_xmalloc(num, float); +REAL4* isvd_smalloc( const size_t num ) { + return isvd_xmalloc(num, REAL4); } -double* isvd_dmalloc( const size_t num ) { - return isvd_xmalloc(num, double); +REAL8* isvd_dmalloc( const size_t num ) { + return isvd_xmalloc(num, REAL8); } -_Complex float* isvd_cmalloc( const size_t num ) { - return isvd_xmalloc(num, _Complex float); +COMP4* isvd_cmalloc( const size_t num ) { + return isvd_xmalloc(num, COMP4); } -_Complex double* isvd_zmalloc( const size_t num ) { - return isvd_xmalloc(num, _Complex double); +COMP8* isvd_zmalloc( const size_t num ) { + return isvd_xmalloc(num, COMP8); } //\} @@ -73,24 +75,24 @@ void isvd_free( void *ptr ) { /// \param num The number of objects. /// //\{ -void isvd_imemset0( isvd_int_t *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, isvd_int_t); +void isvd_imemset0( INT *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, INT); } -void isvd_smemset0( float *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, float); +void isvd_smemset0( REAL4 *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, REAL4); } -void isvd_dmemset0( double *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, double); +void isvd_dmemset0( REAL8 *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, REAL8); } -void isvd_cmemset0( _Complex float *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, _Complex float); +void isvd_cmemset0( COMP4 *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, COMP4); } -void isvd_zmemset0( _Complex double *ptr, const size_t num ) { - isvd_xmemset0(ptr, num, _Complex double); +void isvd_zmemset0( COMP8 *ptr, const size_t num ) { + isvd_xmemset0(ptr, num, COMP8); } //\} @@ -105,23 +107,25 @@ void isvd_zmemset0( _Complex double *ptr, const size_t num ) { /// \param num The number of objects. /// //\{ -void isvd_imemcpy( isvd_int_t *dst, const isvd_int_t *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, isvd_int_t); +void isvd_imemcpy( INT *dst, const INT *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, INT); } -void isvd_smemcpy( float *dst, const float *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, float); +void isvd_smemcpy( REAL4 *dst, const REAL4 *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, REAL4); } -void isvd_dmemcpy( double *dst, const double *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, double); +void isvd_dmemcpy( REAL8 *dst, const REAL8 *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, REAL8); } -void isvd_cmemcpy( _Complex float *dst, const _Complex float *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, _Complex float); +void isvd_cmemcpy( COMP4 *dst, const COMP4 *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, COMP4); } -void isvd_zmemcpy( _Complex double *dst, const _Complex double *src, const size_t num ) { - isvd_xmemcpy(dst, src, num, _Complex double); +void isvd_zmemcpy( COMP8 *dst, const COMP8 *src, const size_t num ) { + isvd_xmemcpy(dst, src, num, COMP8); } //\} + +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/vml/div.c b/src/lib/libisvd/la/vml/div.c index 0699a0c..f8bc043 100644 --- a/src/lib/libisvd/la/vml/div.c +++ b/src/lib/libisvd/la/vml/div.c @@ -9,7 +9,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -32,4 +32,4 @@ void isvd_vzDiv( const INT n, const COMP8 *a, const COMP8 *b, COMP8 *y ) { isvd_ #endif // ISVD_USE_MKL -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/vml/mul.c b/src/lib/libisvd/la/vml/mul.c index 9e6efd8..5ab7fed 100644 --- a/src/lib/libisvd/la/vml/mul.c +++ b/src/lib/libisvd/la/vml/mul.c @@ -9,7 +9,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -32,4 +32,4 @@ void isvd_vzMul( const INT n, const COMP8 *a, const COMP8 *b, COMP8 *y ) { isvd_ #endif // ISVD_USE_MKL -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/vml/sqrt.c b/src/lib/libisvd/la/vml/sqrt.c index 18a871f..1d1068c 100644 --- a/src/lib/libisvd/la/vml/sqrt.c +++ b/src/lib/libisvd/la/vml/sqrt.c @@ -9,7 +9,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -32,4 +32,4 @@ void isvd_vzSqrt( const INT n, const COMP8 *a, COMP8 *y ) { isvd_xSqrt(n, a, y, #endif // ISVD_USE_MKL -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/vml/sub.c b/src/lib/libisvd/la/vml/sub.c index 9f77f4b..a0029df 100644 --- a/src/lib/libisvd/la/vml/sub.c +++ b/src/lib/libisvd/la/vml/sub.c @@ -9,7 +9,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -32,4 +32,4 @@ void isvd_vzSub( const INT n, const COMP8 *a, const COMP8 *b, COMP8 *y ) { isvd_ #endif // ISVD_USE_MKL -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/vsl/@x@_rng_gaussian_driver.c b/src/lib/libisvd/la/vsl/@x@_rng_gaussian_driver.c index eb648df..5cc15b6 100644 --- a/src/lib/libisvd/la/vsl/@x@_rng_gaussian_driver.c +++ b/src/lib/libisvd/la/vsl/@x@_rng_gaussian_driver.c @@ -16,9 +16,9 @@ void isvd_v@x@RngGaussianDriver( const isvd_int_t seed, const isvd_int_t nskip, const isvd_int_t n, - @xtype@ *r, - const @xtype@ a, - const @xtype@ sigma + @xtype_____@ *r, + const @xtype_____@ a, + const @xtype_____@ sigma ) { ISVD_OMP_PARALLEL { diff --git a/src/lib/libisvd/la/vsl/rng_gaussian.c b/src/lib/libisvd/la/vsl/rng_gaussian.c index a04c7bc..62ecefa 100644 --- a/src/lib/libisvd/la/vsl/rng_gaussian.c +++ b/src/lib/libisvd/la/vsl/rng_gaussian.c @@ -10,7 +10,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -34,4 +34,4 @@ void isvd_vdRngGaussian( isvd_VSLStreamStatePtr stream, const INT n, REAL8 *r, c #endif // ISVD_USE_MKL -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/la/vsl/service.c b/src/lib/libisvd/la/vsl/service.c index 445b0ba..8cd93c2 100644 --- a/src/lib/libisvd/la/vsl/service.c +++ b/src/lib/libisvd/la/vsl/service.c @@ -14,7 +14,7 @@ #include #include -@ISVD_LA_BLAS_TYPE_DEFINE@ +@ISVD_TYPE_MACRO_DEFINE@ #if defined(ISVD_USE_MKL) @@ -57,4 +57,4 @@ void isvd_vslSkipAheadStream( isvd_VSLStreamStatePtr stream, const INT nskip ) { #endif // ISVD_USE_MKL -@ISVD_LA_BLAS_TYPE_UNDEF@ +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/nogpu/@x@_stage.c b/src/lib/libisvd/nogpu/@x@_stage.c index 939b69c..16b746a 100644 --- a/src/lib/libisvd/nogpu/@x@_stage.c +++ b/src/lib/libisvd/nogpu/@x@_stage.c @@ -19,19 +19,19 @@ extern "C" { // Sketching void isvd_@x@SketchGaussianProjection_gpu( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - @xtype@ *yst, - const isvd_int_t ldyst, - const isvd_int_t seed, - const mpi_int_t mpi_root + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + @xtype_____@ *yst, + const isvd_int_t ldyst, + const isvd_int_t seed, + const mpi_int_t mpi_root ) { ISVD_UNUSED(param); ISVD_UNUSED(argv); @@ -52,24 +52,24 @@ void isvd_@x@SketchGaussianProjection_gpu( // Postprocessing void isvd_@x@PostprocessTallSkinnyQr_gpu( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - @xtype@ *vt, - const isvd_int_t ldvt, - const mpi_int_t ut_root, - const mpi_int_t vt_root + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const mpi_int_t ut_root, + const mpi_int_t vt_root ) { ISVD_UNUSED(param); ISVD_UNUSED(argv); @@ -94,24 +94,24 @@ void isvd_@x@PostprocessTallSkinnyQr_gpu( } void isvd_@x@PostprocessGramian_gpu( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - @xtype@ *vt, - const isvd_int_t ldvt, - const mpi_int_t ut_root, - const mpi_int_t vt_root + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const mpi_int_t ut_root, + const mpi_int_t vt_root ) { ISVD_UNUSED(param); ISVD_UNUSED(argv); @@ -136,24 +136,24 @@ void isvd_@x@PostprocessGramian_gpu( } void isvd_@x@PostprocessSymmetric_gpu( - const isvd_Param param, - const @xtype@ *argv, - const isvd_int_t argc, - @xtype@ *retv, - const isvd_int_t retc, - const char dista, - const char ordera, - const @xtype@ *a, - const isvd_int_t lda, - const @xtype@ *qt, - const isvd_int_t ldqt, - @xtype@ *s, - @xtype@ *ut, - const isvd_int_t ldut, - @xtype@ *vt, - const isvd_int_t ldvt, - const mpi_int_t ut_root, - const mpi_int_t vt_root + const isvd_Param param, + const @xtype_____@ *argv, + const isvd_int_t argc, + @xtype_____@ *retv, + const isvd_int_t retc, + const char dista, + const char ordera, + const @xtype_____@ *a, + const isvd_int_t lda, + const @xtype_____@ *qt, + const isvd_int_t ldqt, + @xtype_____@ *s, + @xtype_____@ *ut, + const isvd_int_t ldut, + @xtype_____@ *vt, + const isvd_int_t ldvt, + const mpi_int_t ut_root, + const mpi_int_t vt_root ) { ISVD_UNUSED(param); ISVD_UNUSED(argv); diff --git a/src/lib/libisvd/util/io.c b/src/lib/libisvd/util/io.c index 6b50b31..11306c7 100644 --- a/src/lib/libisvd/util/io.c +++ b/src/lib/libisvd/util/io.c @@ -9,6 +9,8 @@ #include #include +@ISVD_TYPE_MACRO_DEFINE@ + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_util_io_module /// \brief Get a variable from stream. @@ -17,25 +19,27 @@ /// \param varp Pointer to the variable. /// //\{ -void isvd_ifget( FILE *stream, isvd_int_t *varp ) { +void isvd_ifget( FILE *stream, INT *varp ) { #if !defined(ISVD_USE_ILP64) - isvd_int_t info = fscanf(stream, "%" PRId32, varp); + INT info = fscanf(stream, "%" PRId32, varp); #else // ISVD_USE_ILP64 - isvd_int_t info = fscanf(stream, "%" PRId64, varp); + INT info = fscanf(stream, "%" PRId64, varp); #endif // ISVD_USE_ILP64 ISVD_UNUSED(info); isvd_assert_eq(info, 1); } -void isvd_sfget( FILE *stream, float *varp ) { - isvd_int_t info = fscanf(stream, "%f", varp); +void isvd_sfget( FILE *stream, REAL4 *varp ) { + INT info = fscanf(stream, "%f", varp); ISVD_UNUSED(info); isvd_assert_eq(info, 1); } -void isvd_dfget( FILE *stream, double *varp ) { - isvd_int_t info = fscanf(stream, "%lf", varp); +void isvd_dfget( FILE *stream, REAL8 *varp ) { + INT info = fscanf(stream, "%lf", varp); ISVD_UNUSED(info); isvd_assert_eq(info, 1); } //\} + +@ISVD_TYPE_MACRO_UNDEF@ diff --git a/src/lib/libisvd/util/mpi.c b/src/lib/libisvd/util/mpi.c index 0c597fc..30af4b7 100644 --- a/src/lib/libisvd/util/mpi.c +++ b/src/lib/libisvd/util/mpi.c @@ -9,11 +9,6 @@ #include #include -#if !defined(DOXYGEN_SHOULD_SKIP_THIS) -#define MPI_COMPLEX_FLOAT MPI_COMPLEX8 -#define MPI_COMPLEX_DOUBLE MPI_COMPLEX16 -#endif // DOXYGEN_SHOULD_SKIP_THIS - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// \ingroup c_util_mpi_module /// \brief Returns the size of the group associated with a communicator.