Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a05cc5e
moved scalapack solvers to algebra, added generic solver interface (S…
evaleev Oct 16, 2020
1494977
amended a05cc5ed302d306bd447a5d7c85aa40b277739f4
evaleev Oct 16, 2020
aab124f
added stub lapack cholesky API
evaleev Oct 16, 2020
068a75d
fixed typo in aab124ff60aac44bf54c4d0ba68114f2454d2e6e
evaleev Oct 16, 2020
b3ea08c
fixed scalapack include path
evaleev Oct 16, 2020
3453f76
hushed warning about copies in range-based for
evaleev Oct 16, 2020
a36249d
dox fixup
evaleev Oct 16, 2020
c719859
default scalapack block size can be controlled at runtime
evaleev Oct 16, 2020
c2c7a86
replaced generic solver interface for cholesky from namespace import …
evaleev Oct 16, 2020
bda146a
fixup
evaleev Oct 16, 2020
7a5c9f0
cast TransposeFlag to scalapackpp's variant
evaleev Oct 16, 2020
e4a0b65
reverted rename of scalapack.cpp to all.cpp in a05cc5ed302d306bd447a5…
evaleev Oct 17, 2020
4754712
fixup
evaleev Oct 17, 2020
9a07b4d
more fixes for apple clang (12) warnings
evaleev Oct 18, 2020
b93b3f6
fixed evp example (includes and use TA::scalapack::heig, not TA::heig)
evaleev Oct 18, 2020
3e800a4
TA::lapack::cholesky* work, tested only as part of scalapack suite
evaleev Oct 19, 2020
1e31689
nrank>1 fixes for lapack::cholesky*
evaleev Oct 19, 2020
00ca849
eigen_to_array assumes that the user knows what she's doing + accepts…
evaleev Oct 19, 2020
d15946e
TA did not know how to serialize Eigen matrices ... really?!
evaleev Oct 19, 2020
03f686c
amended eigen unit tests for 00ca849e19307517b896d55e083e76d140ce21e4
evaleev Oct 20, 2020
6223ab9
typo
evaleev Oct 20, 2020
5297c18
added TA::lapack::heig + reorganized TA::lapack::cholesky
evaleev Oct 20, 2020
13da0a5
TA::eigen_map generalized to accept target matrix layout (default is …
evaleev Oct 20, 2020
16499ce
Introduced OrdinalType
evaleev Oct 20, 2020
114cf48
TA::lapack::cholesky also works for TA::Tensor and ony other contiguo…
evaleev Oct 20, 2020
833a2da
amended 16499ce8197bfe49d2586fd90fc8886c94b52901
evaleev Oct 20, 2020
b8b459a
dox++
evaleev Oct 20, 2020
49fe50e
Merge branch 'tot_devel' into generic-algebra
evaleev Oct 29, 2020
9a1e84f
Refactor lapack bindings
asadchev Nov 16, 2020
40ddb05
fixes for differences in F77 BLAS/LAPACK API in MADNESS and rest of w…
evaleev Nov 17, 2020
3d8bde6
fixes for differences in F77 BLAS/LAPACK API in MADNESS and rest of w…
evaleev Nov 17, 2020
76c0d05
LAPACK algebra backend
asadchev Nov 17, 2020
acefee4
Rename chol.h to cholesky.h
asadchev Nov 20, 2020
abe7576
Refactor linalg unit tests
asadchev Nov 19, 2020
cfa3a93
Set BLA_STATIC=OFF by default
asadchev Nov 20, 2020
217be9a
fixup
asadchev Nov 20, 2020
8355dc5
fixed cholesky_linv unit test
evaleev Nov 20, 2020
be66c44
Merge branch 'andrey/generic-algebra' into generic-algebra
evaleev Nov 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ endif(TILEDARRAY_PRERELEASE_ID)

# Set install paths ============================================================

set(TILEDARRAY_INSTALL_BINDIR "bin"
set(TILEDARRAY_INSTALL_BINDIR "bin"
CACHE PATH "TiledArray binary install directory")
set(TILEDARRAY_INSTALL_INCLUDEDIR "include"
set(TILEDARRAY_INSTALL_INCLUDEDIR "include"
CACHE PATH "TiledArray INCLUDE install directory")
set(TILEDARRAY_INSTALL_LIBDIR "lib"
CACHE PATH "TiledArray LIB install directory")
Expand Down Expand Up @@ -162,16 +162,15 @@ else ()
endif()
redefaultable_option(CMAKE_POSITION_INDEPENDENT_CODE "Default value for POSITION_INDEPENDENT_CODE of targets" ${default_CMAKE_POSITION_INDEPENDENT_CODE})

set(BLA_STATIC FALSE CACHE BOOL "Whether to use static linkage for BLAS, LAPACK, and related libraries")
if(BUILD_SHARED_LIBS)
set(BLA_STATIC FALSE CACHE BOOL "Whether to use static linkage for BLAS, LAPACK, and related libraries")
set(CMAKE_MACOSX_RPATH TRUE)
else()
set(BLA_STATIC TRUE CACHE BOOL "Whether to use static linkage for BLAS, LAPACK, and related libraries")
set(CMAKE_MACOSX_RPATH FALSE)
endif()

# miscellaneous cmake platform-neutral and platform-specific configuration =============================
set(CMAKE_FIND_NO_INSTALL_PREFIX TRUE) # do not search in CMAKE_INSTALL_PREFIX
set(CMAKE_FIND_NO_INSTALL_PREFIX TRUE) # do not search in CMAKE_INSTALL_PREFIX
set(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
Expand Down Expand Up @@ -394,19 +393,19 @@ export(EXPORT tiledarray
configure_package_config_file(cmake/tiledarray-config.cmake.in
"${PROJECT_BINARY_DIR}/tiledarray-config.cmake"
INSTALL_DESTINATION "${TILEDARRAY_INSTALL_CMAKEDIR}"
PATH_VARS CMAKE_INSTALL_PREFIX TILEDARRAY_INSTALL_BINDIR
PATH_VARS CMAKE_INSTALL_PREFIX TILEDARRAY_INSTALL_BINDIR
TILEDARRAY_INSTALL_INCLUDEDIR TILEDARRAY_INSTALL_LIBDIR
TILEDARRAY_INSTALL_DOCDIR TILEDARRAY_INSTALL_CMAKEDIR)

# Install config, version, and target files
install(EXPORT tiledarray
FILE "tiledarray-targets.cmake"
DESTINATION "${TILEDARRAY_INSTALL_CMAKEDIR}"
DESTINATION "${TILEDARRAY_INSTALL_CMAKEDIR}"
COMPONENT tiledarray)
install(FILES
"${PROJECT_BINARY_DIR}/tiledarray-config.cmake"
"${PROJECT_BINARY_DIR}/tiledarray-config-version.cmake"
DESTINATION "${TILEDARRAY_INSTALL_CMAKEDIR}"
DESTINATION "${TILEDARRAY_INSTALL_CMAKEDIR}"
COMPONENT tiledarray)


Expand Down
31 changes: 15 additions & 16 deletions examples/scalapack/evp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <scalapackpp/eigenvalue_problem/sevp.hpp>
#include <scalapackpp/pblas/gemm.hpp>

#include <TiledArray/math/scalapack.h>
#include <TiledArray/algebra/scalapack/heig.h>

using Array = TA::TArray<double>;
// using Array = TA::TSpArray<double>;
Expand Down Expand Up @@ -93,23 +93,22 @@ int main(int argc, char** argv) {
tensor_symm("i,j") = 0.5 * (tensor("i,j") + tensor("j,i"));
tensor("i,j") = tensor_symm("i,j");


auto [ evals, evecs_ta ] = TA::heig( tensor );

auto [evals, evecs_ta] = TA::scalapack::heig(tensor);

//// Check EVP with TA
Array tmp = TA::foreach (evecs_ta, [evals = evals](TA::Tensor<double>& result,
const TA::Tensor<double>& arg) {
result = TA::clone(arg);

auto range = arg.range();
auto lo = range.lobound_data();
auto up = range.upbound_data();
for (auto m = lo[0]; m < up[0]; ++m)
for (auto n = lo[1]; n < up[1]; ++n) {
result(m, n) = arg(m, n) * evals[n];
}
});
Array tmp =
TA::foreach (evecs_ta, [evals = evals](TA::Tensor<double>& result,
const TA::Tensor<double>& arg) {
result = TA::clone(arg);

auto range = arg.range();
auto lo = range.lobound_data();
auto up = range.upbound_data();
for (auto m = lo[0]; m < up[0]; ++m)
for (auto n = lo[1]; n < up[1]; ++n) {
result(m, n) = arg(m, n) * evals[n];
}
});

world.gop.fence();
tensor("i,j") = tensor("i,j") - tmp("i,k") * evecs_ta("j,k");
Expand Down
19 changes: 15 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ TiledArray/zero_tensor.h
TiledArray/algebra/conjgrad.h
TiledArray/algebra/diis.h
TiledArray/algebra/utils.h
TiledArray/algebra/cholesky.h
TiledArray/algebra/heig.h
TiledArray/algebra/lu.h
TiledArray/algebra/svd.h
TiledArray/algebra/types.h
TiledArray/algebra/lapack/cholesky.h
TiledArray/algebra/lapack/heig.h
TiledArray/algebra/lapack/util.h
TiledArray/algebra/lapack/lu.h
TiledArray/algebra/lapack/svd.h
TiledArray/algebra/scalapack/cholesky.h
TiledArray/algebra/scalapack/heig.h
TiledArray/algebra/scalapack/lu.h
TiledArray/algebra/scalapack/svd.h
TiledArray/conversions/btas.h
TiledArray/conversions/clone.h
TiledArray/conversions/dense_to_sparse.h
Expand Down Expand Up @@ -112,8 +126,6 @@ TiledArray/math/partial_reduce.h
TiledArray/math/transpose.h
TiledArray/math/vector_op.h
TiledArray/math/scalapack.h
TiledArray/math/scalapack/heig.h
TiledArray/math/scalapack/chol.h
TiledArray/pmap/blocked_pmap.h
TiledArray/pmap/cyclic_pmap.h
TiledArray/pmap/hash_pmap.h
Expand Down Expand Up @@ -197,6 +209,7 @@ TiledArray/array_impl.cpp
TiledArray/dist_array.cpp
TiledArray/util/backtrace.cpp
TiledArray/util/bug.cpp
TiledArray/algebra/lapack/lapack.cpp
)

# the list of libraries on which TiledArray depends on, will be cached later
Expand Down Expand Up @@ -292,5 +305,3 @@ install(
FILES_MATCHING PATTERN "*.h"
PATTERN "CMakeFiles" EXCLUDE
)


77 changes: 77 additions & 0 deletions src/TiledArray/algebra/cholesky.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* This file is a part of TiledArray.
* Copyright (C) 2020 Virginia Tech
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Eduard Valeyev
*
* chol.h
* Created: 16 October, 2020
*
*/
#ifndef TILEDARRAY_ALGEBRA_CHOL_H__INCLUDED
#define TILEDARRAY_ALGEBRA_CHOL_H__INCLUDED

#include <TiledArray/config.h>
#if TILEDARRAY_HAS_SCALAPACK
#include <TiledArray/algebra/scalapack/cholesky.h>
#endif
#include <TiledArray/algebra/lapack/cholesky.h>

namespace TiledArray {

template <typename Array>
auto cholesky(const Array& A, TiledRange l_trange = TiledRange()) {
#if TILEDARRAY_HAS_SCALAPACK
if (A.world().size() > 1 && A.range().volume() > 10000000)
return scalapack::cholesky<Array>(A, l_trange);
#endif
return lapack::cholesky<Array>(A, l_trange);
}

template <typename Array, bool RetL = false>
auto cholesky_linv(const Array& A, TiledRange l_trange = TiledRange()) {
#if TILEDARRAY_HAS_SCALAPACK
if (A.world().size() > 1 && A.range().volume() > 10000000)
return scalapack::cholesky_linv<Array, RetL>(A, l_trange);
#endif
return lapack::cholesky_linv<Array, RetL>(A, l_trange);
}

template <typename Array>
auto cholesky_solve(const Array& A, const Array& B,
TiledRange x_trange = TiledRange()) {
#if TILEDARRAY_HAS_SCALAPACK
if (A.world().size() > 1 && A.range().volume() > 10000000)
return scalapack::cholesky_solve<Array>(A, B, x_trange);
#endif
return lapack::cholesky_solve<Array>(A, B, x_trange);
}

template <typename Array>
auto cholesky_lsolve(TransposeFlag transpose, const Array& A, const Array& B,
TiledRange l_trange = TiledRange(),
TiledRange x_trange = TiledRange()) {
#if TILEDARRAY_HAS_SCALAPACK
if (A.world().size() > 1 && A.range().volume() > 10000000)
return scalapack::cholesky_lsolve<Array>(transpose, A, B, l_trange,
x_trange);
#endif
return lapack::cholesky_lsolve<Array>(transpose, A, B, l_trange, x_trange);
}

} // namespace TiledArray

#endif // TILEDARRAY_ALGEBRA_CHOL_H__INCLUDED
57 changes: 57 additions & 0 deletions src/TiledArray/algebra/heig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* This file is a part of TiledArray.
* Copyright (C) 2020 Virginia Tech
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Eduard Valeyev
*
* heig.h
* Created: 16 October, 2020
*
*/
#ifndef TILEDARRAY_ALGEBRA_HEIG_H__INCLUDED
#define TILEDARRAY_ALGEBRA_HEIG_H__INCLUDED

#include <TiledArray/config.h>
#if TILEDARRAY_HAS_SCALAPACK
#include <TiledArray/algebra/scalapack/heig.h>
#endif
#include <TiledArray/algebra/lapack/heig.h>

namespace TiledArray {

template <typename Array>
auto heig(const Array& A, TiledRange evec_trange = TiledRange()) {
#if TILEDARRAY_HAS_SCALAPACK
if (A.world().size() > 1 && A.range().volume() > 10000000) {
return scalapack::heig(A, evec_trange);
}
#endif
return lapack::heig(A, evec_trange);
}

template <typename ArrayA, typename ArrayB, typename EVecType = ArrayA>
auto heig(const ArrayA& A, const ArrayB& B, TiledRange evec_trange = TiledRange()) {
#if TILEDARRAY_HAS_SCALAPACK
if (A.world().size() > 1 && A.range().volume() > 10000000) {
return scalapack::heig(A, B, evec_trange);
}
#endif
return lapack::heig(A, B, evec_trange);
}

} // namespace TiledArray

#endif // TILEDARRAY_ALGEBRA_HEIG_H__INCLUDED
Loading