Skip to content

Commit

Permalink
disable the symcheck in the C/Fortran interface, with an assumption t…
Browse files Browse the repository at this point in the history
…hat they have already been symmetrized.
  • Loading branch information
brunowu committed Dec 19, 2024
1 parent 6b59c7e commit 6730655
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 79 deletions.
32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,38 @@ if(CHASE_BUILD_WITH_DOCS)
add_subdirectory("docs")
endif()

#get_target_property(interface_defs mpi_grid_nccl INTERFACE_COMPILE_DEFINITIONS)
#message("INTERFACE_COMPILE_DEFINITIONS: ${interface_defs}")

# List all dependencies (linked targets)
#get_target_property(linked_libraries pchase_gpu INTERFACE_LINK_LIBRARIES)
#message("linked_libraries: ${linked_libraries}")
# Prepare a list to store definitions
#set(all_inherited_defs "")

#foreach(dep ${linked_libraries})
# # Check if the dependency is a valid target
# if(TARGET ${dep})
# # Get INTERFACE_COMPILE_DEFINITIONS from the dependency
# get_target_property(dep_defs ${dep} INTERFACE_COMPILE_DEFINITIONS)
#
# # Append to the list
# if(dep_defs)
# list(APPEND all_inherited_defs ${dep_defs})
# endif()
# endif()
#endforeach()

# Remove duplicates (optional)
#list(REMOVE_DUPLICATES all_inherited_defs)

# Print all inherited definitions
#message("Inherited compile definitions: ${all_inherited_defs}")
#get_target_property(linked_libraries blaspp INTERFACE_LINK_LIBRARIES)
#message("Libraries linked by blaspp: ${linked_libraries}")
#get_target_property(blas_library ${linked_libraries} IMPORTED_LOCATION)
#message("BLAS library path: ${blas_library}")


##installation
install( TARGETS chase_algorithm
Expand Down
91 changes: 16 additions & 75 deletions interface/chase_c_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ void ChASE_SEQ_Solve(int* deg, chase::Base<T>* tol, char* mode, char* opt, char*
config.SetOpt(*opt == 'S');
config.SetApprox(*mode == 'A');
config.SetCholQR(*qr == 'C');
config.EnableSymCheck(false);

chase::PerformanceDecoratorChase<T> performanceDecorator(single);
chase::Solve(&performanceDecorator);
Expand Down Expand Up @@ -297,15 +298,8 @@ int ChASE_DIST<BlockMatrixType<std::complex<double>>>::Initialize(int N, int nev
zHmat = new BlockMatrixType<std::complex<double>>(N, N, m, n, mbsize, nbsize, ldh, H, mpi_grid);
zVec = new DistMultiVector1DColumn<std::complex<double>>(N, m, nev + nex, mbsize, m, V, mpi_grid);

//const char* backend_env = std::getenv("CHASE_COMM_BACKEND");
//std::string backend(backend_env);
//if (backend == "MPI") {
// zchaseDist = new DistSolverType<BlockMatrixType<std::complex<double>>, chase::grid::backend::MPI>(nev, nex, zHmat, zVec, ritzv);
//}
//else
{
zchaseDist = new DistSolverType<BlockMatrixType<std::complex<double>>>(nev, nex, zHmat, zVec, ritzv);
}
zchaseDist = new DistSolverType<BlockMatrixType<std::complex<double>>>(nev, nex, zHmat, zVec, ritzv);

return 1;
}

Expand Down Expand Up @@ -337,15 +331,8 @@ int ChASE_DIST<BlockMatrixType<std::complex<float>>>::Initialize(int N, int nev,
cHmat = new BlockMatrixType<std::complex<float>>(N, N, m, n, mbsize, nbsize, ldh, H, mpi_grid);
cVec = new DistMultiVector1DColumn<std::complex<float>>(N, m, nev + nex, mbsize, m, V, mpi_grid);

//const char* backend_env = std::getenv("CHASE_COMM_BACKEND");
//std::string backend(backend_env);
//if (backend == "MPI") {
// cchaseDist = new DistSolverType<BlockMatrixType<std::complex<float>>, chase::grid::backend::MPI>(nev, nex, cHmat, cVec, ritzv);
//}
//else
{
cchaseDist = new DistSolverType<BlockMatrixType<std::complex<float>>>(nev, nex, cHmat, cVec, ritzv);
}
cchaseDist = new DistSolverType<BlockMatrixType<std::complex<float>>>(nev, nex, cHmat, cVec, ritzv);

return 1;
}

Expand Down Expand Up @@ -377,16 +364,8 @@ int ChASE_DIST<BlockMatrixType<float>>::Initialize(int N, int nev, int nex, int
sHmat = new BlockMatrixType<float>(N, N, m, n, mbsize, nbsize, ldh, H, mpi_grid);
sVec = new DistMultiVector1DColumn<float>(N, m, nev + nex, mbsize, m, V, mpi_grid);

//const char* backend_env = std::getenv("CHASE_COMM_BACKEND");
//std::string backend(backend_env);
//if (backend == "MPI") {
// schaseDist = new DistSolverType<BlockMatrixType<float>, chase::grid::backend::MPI>(nev, nex, sHmat, sVec, ritzv);
//}
//else
{
schaseDist = new DistSolverType<BlockMatrixType<float>>(nev, nex, sHmat, sVec, ritzv);
}

schaseDist = new DistSolverType<BlockMatrixType<float>>(nev, nex, sHmat, sVec, ritzv);

return 1;
}

Expand Down Expand Up @@ -418,15 +397,7 @@ int ChASE_DIST<BlockMatrixType<double>>::Initialize(int N, int nev, int nex, int
dHmat = new BlockMatrixType<double>(N, N, m, n, mbsize, nbsize, ldh, H, mpi_grid);
dVec = new DistMultiVector1DColumn<double>(N, m, nev + nex, mbsize, m, V, mpi_grid);

//const char* backend_env = std::getenv("CHASE_COMM_BACKEND");
//std::string backend(backend_env);
//if (backend == "MPI") {
// dchaseDist = new DistSolverType<BlockMatrixType<double>, chase::grid::backend::MPI>(nev, nex, dHmat, dVec, ritzv);
//}
//else
{
dchaseDist = new DistSolverType<BlockMatrixType<double>>(nev, nex, dHmat, dVec, ritzv);
}
dchaseDist = new DistSolverType<BlockMatrixType<double>>(nev, nex, dHmat, dVec, ritzv);

return 1;
}
Expand All @@ -452,15 +423,7 @@ int ChASE_DIST<BlockMatrixType<std::complex<double>>>::Initialize(int N, int nev
zHmat = new BlockMatrixType<std::complex<double>>(m, n, ldh, H, mpi_grid);
zVec = new DistMultiVector1DColumn<std::complex<double>>(m, nev + nex, m, V, mpi_grid);

//const char* backend_env = std::getenv("CHASE_COMM_BACKEND");
//std::string backend(backend_env);
//if (backend == "MPI") {
// zchaseDist = new DistSolverType<BlockMatrixType<std::complex<double>>, chase::grid::backend::MPI>(nev, nex, zHmat, zVec, ritzv);
//}
//else
{
zchaseDist = new DistSolverType<BlockMatrixType<std::complex<double>>>(nev, nex, zHmat, zVec, ritzv);
}
zchaseDist = new DistSolverType<BlockMatrixType<std::complex<double>>>(nev, nex, zHmat, zVec, ritzv);

return 1;
}
Expand All @@ -485,15 +448,7 @@ int ChASE_DIST<BlockMatrixType<std::complex<float>>>::Initialize(int N, int nev,
cHmat = new BlockMatrixType<std::complex<float>>(m, n, ldh, H, mpi_grid);
cVec = new DistMultiVector1DColumn<std::complex<float>>(m, nev + nex, m, V, mpi_grid);

//const char* backend_env = std::getenv("CHASE_COMM_BACKEND");
//std::string backend(backend_env);
//if (backend == "MPI") {
// cchaseDist = new DistSolverType<BlockMatrixType<std::complex<float>>, chase::grid::backend::MPI>(nev, nex, cHmat, cVec, ritzv);
//}
//else
{
cchaseDist = new DistSolverType<BlockMatrixType<std::complex<float>>>(nev, nex, cHmat, cVec, ritzv);
}
cchaseDist = new DistSolverType<BlockMatrixType<std::complex<float>>>(nev, nex, cHmat, cVec, ritzv);

return 1;
}
Expand All @@ -518,16 +473,8 @@ int ChASE_DIST<BlockMatrixType<float>>::Initialize(int N, int nev, int nex, int
sHmat = new BlockMatrixType<float>(m, n, ldh, H, mpi_grid);
sVec = new DistMultiVector1DColumn<float>(m, nev + nex, m, V, mpi_grid);

//const char* backend_env = std::getenv("CHASE_COMM_BACKEND");
//std::string backend(backend_env);
//if (backend == "MPI") {
// schaseDist = new DistSolverType<BlockMatrixType<float>, chase::grid::backend::MPI>(nev, nex, sHmat, sVec, ritzv);
//}
//else
{
schaseDist = new DistSolverType<BlockMatrixType<float>>(nev, nex, sHmat, sVec, ritzv);
}

schaseDist = new DistSolverType<BlockMatrixType<float>>(nev, nex, sHmat, sVec, ritzv);

return 1;
}

Expand All @@ -551,15 +498,7 @@ int ChASE_DIST<BlockMatrixType<double>>::Initialize(int N, int nev, int nex, int
dHmat = new BlockMatrixType<double>(m, n, ldh, H, mpi_grid);
dVec = new DistMultiVector1DColumn<double>(m, nev + nex, m, V, mpi_grid);

//const char* backend_env = std::getenv("CHASE_COMM_BACKEND");
//std::string backend(backend_env);
//if (backend == "MPI") {
// dchaseDist = new DistSolverType<BlockMatrixType<double>, chase::grid::backend::MPI>(nev, nex, dHmat, dVec, ritzv);
//}
//else
{
dchaseDist = new DistSolverType<BlockMatrixType<double>>(nev, nex, dHmat, dVec, ritzv);
}
dchaseDist = new DistSolverType<BlockMatrixType<double>>(nev, nex, dHmat, dVec, ritzv);

return 1;
}
Expand Down Expand Up @@ -641,6 +580,7 @@ int ChASE_DIST<BlockMatrixType<float>>::Finalize()
template<typename MatrixType>
void ChASE_DIST<MatrixType>::Solve(int* deg, chase::Base<typename MatrixType::value_type>* tol, char* mode, char* opt, char *qr)
{
using T = typename MatrixType::value_type;
auto single = ChASE_DIST<MatrixType>::getChase();

chase::ChaseConfig<T>& config = single->GetConfig();
Expand All @@ -649,7 +589,8 @@ void ChASE_DIST<MatrixType>::Solve(int* deg, chase::Base<typename MatrixType::va
config.SetOpt(*opt == 'S');
config.SetApprox(*mode == 'A');
config.SetCholQR(*qr == 'C');

config.EnableSymCheck(false);

chase::PerformanceDecoratorChase<T> performanceDecorator(single);

chase::Solve(&performanceDecorator);
Expand Down
2 changes: 1 addition & 1 deletion linalg/internal/cuda_aware_mpi/rayleighRitz.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace internal
{
using T = typename MatrixType::value_type;

std::cout <<"MPI Backend" << std::endl;
//std::cout <<"MPI Backend" << std::endl;

std::unique_ptr<chase::distMatrix::RedundantMatrix<T, chase::platform::GPU>> A_ptr;
std::size_t upperTriangularSize = std::size_t(subSize * (subSize + 1) / 2);
Expand Down
2 changes: 1 addition & 1 deletion linalg/internal/nccl/rayleighRitz.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace internal
)
{
using T = typename MatrixType::value_type;
std::cout <<"NCCL Backend" << std::endl;
//std::cout <<"NCCL Backend" << std::endl;

std::unique_ptr<chase::distMatrix::RedundantMatrix<T, chase::platform::GPU>> A_ptr;
std::size_t upperTriangularSize = std::size_t(subSize * (subSize + 1) / 2);
Expand Down
4 changes: 2 additions & 2 deletions linalg/internal/nccl/symOrHerm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ namespace internal
chase::linalg::scalapackpp::t_ptranc(H.g_rows(),
H.g_cols(),
One,
H.l_data(),
H.cpu_data(),
one, one, desc, Zero, tmp.data(), one, one, desc);
#pragma omp parallel for
for(auto j = 0; j < H.l_cols(); j++)
{
for(auto i = 0; i < H.l_rows(); i++)
{
H.l_data()[i + j * H.l_ld()] += tmp[i + j * H.l_rows()];
H.cpu_data()[i + j * H.l_ld()] += tmp[i + j * H.l_rows()];
}
}

Expand Down

0 comments on commit 6730655

Please sign in to comment.