Skip to content

Commit

Permalink
Merge branch 'hotfix/1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
emfomy committed Aug 16, 2018
2 parents 71bbfe0 + 0d1e50f commit bd0544f
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 43 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include(cmake/old.cmake)
set(ISVD_NAME "Integrated Singular Value Decomposition")
set(ISVD_MAJOR_VERSION 1)
set(ISVD_MINOR_VERSION 3)
set(ISVD_PATCH_VERSION 0)
set(ISVD_PATCH_VERSION 1)
set(ISVD_VERSION "${ISVD_MAJOR_VERSION}.${ISVD_MINOR_VERSION}.${ISVD_PATCH_VERSION}")
if(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
cmake_policy(SET CMP0048 OLD)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ This library is a C implementation of the Integrated Singular Value Decompositio
* [CMake](https://cmake.org) 2.8.11+ (CMake 3.0+ recommended).
* C/C++ compiler with C99/C++98 standard support ([GCC](https://gcc.gnu.org) 4.4+ recommended).
* [BLAS](http://www.netlib.org/blas) & [LAPACK](http://www.netlib.org/lapack) library (Used for multi-core parallelization).
* MPI Library v2.2+ ([MPICH](http://www.mpich.org) or [OpenMPI](https://www.open-mpi.org)).
* MPI Library with 2.2+ standard support ([MPICH](http://www.mpich.org) 1.2+ or [OpenMPI](https://www.open-mpi.org) 1.7+).

## Optional
* [Intel® Math Kernel Library](https://software.intel.com/en-us/intel-mkl) (**Recommended** for better performance, used for BLAS & LAPACK).
* [MAGMA](http://icl.cs.utk.edu/magma/) 2+ (Used for BLAS & LAPACK with GPU support).
* [MAGMA](http://icl.cs.utk.edu/magma/) 2.0+ (Used for BLAS & LAPACK with GPU support).
* [OpenMP](http://openmp.org) Library (**Recommended** for better performance, used for multi-thread parallelization).
* [Google Test Library](https://github.com/google/googletest) (Used for code testing).
* [Doxygen](http://www.stack.nl/~dimitri/doxygen/) (Used for documentation).
Expand Down Expand Up @@ -141,7 +141,7 @@ Please link exactly one library for all categories.

## How to use 64-bit integer?

* Set `ISVD_USE_ILP64` with `ccmake` before building libraries.
* Set `ISVD_USE_ILP64` with `ccmake` before building libraries; or
* Add `-DISVD_USE_ILP64` to compile flag.
* Make sure your LAPACK&BLAS / Intel MKL uses 64bit integer.

Expand Down
42 changes: 22 additions & 20 deletions cmake/display.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,75 +76,77 @@ disp("Build type: " "${CMAKE_BUILD_TYPE}")
message(STATUS "")

# Display compilers
disp("Use C Compiler: " "${CMAKE_C_COMPILER}")
disp("Use C++ Compiler: " "${CMAKE_CXX_COMPILER}")
disp("C compiler: " "${CMAKE_C_COMPILER}")
disp("C++ compiler: " "${CMAKE_CXX_COMPILER}")

message(STATUS "")

string(TOUPPER "CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}" cflag_build)
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" cxxflag_build)

disp("Use C flags: " "${CMAKE_C_FLAGS} ${${cflag_build}}")
disp("Use C++ flags: " "${CMAKE_CXX_FLAGS} ${${cxxflag_build}}")
disp("Use libraries: " "${DEFAULT_LIBRARY}")
disp("C flags: " "${CMAKE_C_FLAGS} ${${cflag_build}}")
disp("C++ flags: " "${CMAKE_CXX_FLAGS} ${${cxxflag_build}}")
disp("System libraries: " "${DEFAULT_LIBRARY}")

message(STATUS "")

# Display libraries

if(ISVD_USE_PACKAGE AND ISVD_OMP)
disp("Use OpenMP: " "${OpenMP_LIBRARIES}")
disp("OpenMP: " "${OpenMP_LIBRARIES}")
else()
disp("Use OpenMP: " "OFF")
disp("OpenMP: " "OFF")
endif()

if(ISVD_USE_PACKAGE)
disp("Use MPI: " "${MPI_C_LIBRARIES}")
disp("MPI: " "${MPI_C_LIBRARIES}")
else()
disp("Use MPI: " "OFF")
disp("MPI: " "OFF")
endif()

if(ISVD_USE_PACKAGE)
if(NOT ISVD_USE_MKL)
set(LAPACK_LIBS ${LAPACK_LIBRARIES})
list(REMOVE_DUPLICATES LAPACK_LIBS)
disp("Use BLAS: " "${LAPACK_LIBS}")
disp("BLAS: " "${LAPACK_LIBS}")
else()
disp("Use BLAS: (Intel MKL) " "${MKL_LIBS}")
disp("BLAS: (Intel MKL) " "${MKL_LIBS}")
endif()
endif()

if(ISVD_USE_PACKAGE AND ISVD_USE_GPU)
disp("Use GPU: " "${CUDA_TOOLKIT_ROOT_DIR}")
disp("Use MAGMA: " "${MAGMA_LIBRARIES}")
disp("GPU: " "${CUDA_TOOLKIT_ROOT_DIR}")
disp("MAGMA: " "${MAGMA_LIBRARIES}")
else()
disp("Use GPU: " "OFF")
disp("GPU: " "OFF")
endif()

if(ISVD_BUILD_TEST)
disp("Use Google Test: " "${GTEST_BOTH_LIBRARIES}")
disp("Google Test: " "${GTEST_BOTH_LIBRARIES}")
else()
disp("Use Google Test: " "OFF")
disp("Google Test: " "OFF")
endif()

if(ISVD_BUILD_DOC)
disp("Use Doxygen: " "${DOXYGEN_EXECUTABLE}")
disp("Doxygen: " "${DOXYGEN_EXECUTABLE}")
else()
disp("Use Doxygen: " "OFF")
disp("Doxygen: " "OFF")
endif()

message(STATUS "")

if(ISVD_USE_PACKAGE)
disp("MPI processes (demo only): " "${MPI_PROCS}")
disp("OpenMP threads (demo only): " "${OMP_THRDS}")
if(ISVD_OMP)
disp("OpenMP threads (demo only): " "${OMP_THRDS}")
endif()
endif()

message(STATUS "")
message(STATUS "================================================================================")
message(STATUS "")

if(ISVD_USE_PACKAGE)
if(ISVD_USE_PACKAGE AND CMAKE_WARNING)
if(ISVD_BLAS STREQUAL "BLAS" AND ISVD_OMP)
message(${DEPRECATION} "${Esc}[1;33mPlain BLAS library might not support OpenMP multithreading.${Esc}[0m")
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ option(ISVD_BUILD_DOC "Build documentation." "ON")
option(ISVD_USE_GPU "Enable GPU support." "OFF")
option(ISVD_TEST_DEEP "Enable deep unit tests." "ON")
option(ISVD_TEST_VERBOSE "Enable verbose unit tests." "ON")
option(CMAKE_WARNING "Enable CMake warning." "ON")

set(ISVD_INDEX_TYPE "32" CACHE STRING "Index type. [32/64]")
set_property(CACHE ISVD_INDEX_TYPE PROPERTY STRINGS "32;64")
Expand Down
2 changes: 1 addition & 1 deletion cmake/packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ else()
endif()

# MPI
find_package(MPI ${findtype})
find_package(MPI 2.2 ${findtype})
function(ISVD_SET_TARGET_MPI target lang)
target_include_directories(${target} ${SYSTEM} PRIVATE "${MPI_${lang}_INCLUDE_PATH}")
target_link_libraries(${target} ${MPI_${lang}_LIBRARIES})
Expand Down
3 changes: 2 additions & 1 deletion demo/cdemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ int main( int argc, char **argv ) {

/// [allocate-matrix]
// Allocate matrix
const isvd_int_t k = 20, p = 12, l = k+p, N = 16;
const isvd_int_t k = 20, p = 12, N = 16;
const isvd_Param param = isvd_createParam(m, n, k, p, N, mpi_root, MPI_COMM_WORLD);
const isvd_int_t mb = param.nrow_each;
const isvd_int_t Pmb = param.nrow_total;
const isvd_int_t Pnb = param.ncol_total;
const isvd_int_t l = param.dim_sketch;

double *s = isvd_dMalloc(l);

Expand Down
12 changes: 2 additions & 10 deletions demo/ctest.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,8 @@ int main( int argc, char **argv ) {
isvd_PrintEnvironment(MPI_COMM_WORLD);
}

const isvd_int_t m = 100;
const isvd_int_t k = 10;

isvd_d_val_t *q = isvd_dMalloc(k * m);
const isvd_int_t ldq = k;

isvd_d_val_t *tau = isvd_dMalloc(k);

isvd_dGelqf(k, m, q, ldq, tau);
isvd_dOrglq(k, m, k, q, ldq, tau);
const isvd_int_t m = 100, n = 1000, k = 20, p = 12, N = 16;
const isvd_Param param = isvd_createParam(m, n, k, p, N, mpi_root, MPI_COMM_WORLD);

isvd_Finalize();

Expand Down
4 changes: 3 additions & 1 deletion doxygen/tutorial/core/example.dox
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
Above example code can be compiled by

```
gcc demo/cdemo.c -I<include-path> -L<library-path> -Wl,-rpath <library-path> -lisvd_core -lisvd_la_mkl_gomp -lisvd_gpu_none
gcc demo/cdemo.c <path-to-source>/ext/mmio/mmio.c -include <path-to-source>/ext/mmio/mmio.h -I<include-path> -L<library-path> -Wl,-rpath <library-path> -lisvd_core -lisvd_la_mkl_gomp -lisvd_gpu_none
```

where <include-path> is the folder containing the header files (located at <path-to-source>/build/include), and <library-path> is the folder containing the libraries (located at <path-to-source>/build/lib).

One may also use **make run_cdemo** to compile and run it.

The outputs of the example are shown as below. (Note that the detailed number might be different due to the executing environment.)
Expand Down
2 changes: 1 addition & 1 deletion doxygen/tutorial/core/stage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

The postprocessing stage forms a rank-𝑘 approximate SVD of \f$\boldsymbol{A}\f$ in the range of \f$\overline{\boldsymbol{Q}}\f$.

- The \ref isvd_dPostprocessTallSkinnyQr "Tall-Skinny QR Orthogonalization" finds the orthonormal basis using the Tall-Skinny QR (TSQR) decomposition.
- The \ref isvd_dPostprocessTallSkinnyQr "Tall-Skinny QR Postprocessing" finds the orthonormal basis using the Tall-Skinny QR (TSQR) decomposition.
- The \ref isvd_dPostprocessGramian "Gramian Postprocessing" finds approximate SVD using the eigen-decomposition of \f$\overline{\boldsymbol{Q}}^\top \boldsymbol{A} \boldsymbol{A}^\top \overline{\boldsymbol{Q}}\f$.
- The \ref isvd_dPostprocessSymmetric "Symmetric Postprocessing" finds approximate SVD using the eigen-decomposition of \f$\overline{\boldsymbol{Q}}^\top \boldsymbol{A} \overline{\boldsymbol{Q}}\f$ for symmetric input matrix \f$\boldsymbol{A}\f$.
*/
2 changes: 1 addition & 1 deletion src/include/c/isvd/def.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ typedef int omp_int_t;
/// \brief The MPI communicator type.
#if !defined(DOXYGEN_SHOULD_SKIP_THIS)
#if !defined(__cplusplus)
typedef void* isvd_MpiComm;
typedef int isvd_MpiComm;
#else // __cplusplus
#include <mpi.h>
typedef MPI_Comm isvd_MpiComm;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libisvd/core/stage/@x@_sketch.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static void sketchBlockRow(
// Random generate

isvd_int_t seed_ = seed;
isvd_assert_pass(MPI_Bcast(&seed_, sizeof(isvd_VSLStreamStatePtr), MPI_BYTE, mpi_root, param.mpi_comm));
isvd_assert_pass(MPI_Bcast(&seed_, sizeof(seed_), MPI_BYTE, mpi_root, param.mpi_comm));
isvd_v@x@RngGaussianDriver(seed_, 0, n * Nl, omegat, 0.0, 1.0);

// ====================================================================================================================== //
Expand Down
6 changes: 3 additions & 3 deletions src/lib/libisvd/gpu/stage/@x@_postprocess_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ static void projectBlockRow(
isvd_Free(zt_);
}

// magma_free(a_gpu);
// magma_free(qt_gpu);
// magma_free(zt_gpu);
magma_free(a_gpu);
magma_free(qt_gpu);
magma_free(zt_gpu);

}
#endif // DOXYGEN_SHOULD_SKIP_THIS
Expand Down

0 comments on commit bd0544f

Please sign in to comment.