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.