Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaypanyala committed Oct 11, 2024
1 parent 8f12f21 commit 8f3bf0a
Show file tree
Hide file tree
Showing 47 changed files with 476 additions and 307 deletions.
40 changes: 31 additions & 9 deletions exachem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,37 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/scf/scf.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/common/common.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/mp2/mp2.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cholesky/cholesky.cmake)

include(${CMAKE_CURRENT_SOURCE_DIR}/cc/cc.cmake)

#Add the current directory's sources to the list
set(EXACHEM_SRCS ${SCF_SRCS} ${COMMON_SRCS} ${MP2_SRCS} ${CD_SRCS} ${CC2_SRCS} ${CCSD_SRCS} ${CCSD_T_SRCS})

#Add the current directory's header files to the list
set(EXACHEM_INCLUDES ${SCF_INCLUDES} ${COMMON_INCLUDES} ${CD_INCLUDES} ${MP2_INCLUDES}
${CC_INCLUDES} ${CC2_INCLUDES} ${CCSD_INCLUDES} ${CCSD_T_INCLUDES})
include(${CMAKE_CURRENT_SOURCE_DIR}/task/task.cmake)

option(EC_COMPLEX "enable complex codes" ON)

list(FIND MODULES "CC" _cc_index)

if(NOT _cc_index EQUAL -1)
message(STATUS "Compiling CC modules")

include(${CMAKE_CURRENT_SOURCE_DIR}/fci/fci.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cc/cc.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cc/eom/eom.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cc/lambda/lambda.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cc/ducc/ducc.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cc/ccsdt/ccsdt.cmake)

if(NOT USE_UPCXX AND EC_COMPLEX)
include(${CMAKE_CURRENT_SOURCE_DIR}/cc/gfcc/gfcc.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cc/rteom/rteom.cmake)
endif()

endif()

#Add the various modules sources to the list
set(EXACHEM_SRCS ${SCF_SRCS} ${COMMON_SRCS} ${MP2_SRCS} ${CD_SRCS} ${CC2_SRCS} ${CCSD_SRCS} ${CCSD_T_SRCS} ${FCI_SRCS}
${CCSDT_SRCS} ${CC_LAMBDA_SRCS} ${DUCC_SRCS} ${CC_EOM_SRCS} ${RTEOM_SRCS} ${GFCC_SRCS} ${TASK_SRCS})

#Add the various modules header files to the list
set(EXACHEM_INCLUDES ${SCF_INCLUDES} ${COMMON_INCLUDES} ${CD_INCLUDES} ${MP2_INCLUDES} ${DUCC_INCLUDES}
${CC_INCLUDES} ${CC2_INCLUDES} ${CCSD_INCLUDES} ${CCSD_T_INCLUDES} ${CC_EOM_INCLUDES} ${FCI_INCLUDES}
${CC_LAMBDA_INCLUDES} ${RTEOM_INCLUDES} ${GFCC_INCLUDES} ${CCSDT_INCLUDES} ${TASK_INCLUDES})

cmsb_add_library(exachem EXACHEM_SRCS EXACHEM_INCLUDES EXACHEM_CFLAGS EXACHEM_LFLAGS)
target_include_directories(exachem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
1 change: 1 addition & 0 deletions exachem/cc/cc2/cc2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(CC2_SRCS
)

set(CC2_INCLUDES
${CC2_SRCDIR}/cd_cc2.hpp
${CC2_SRCDIR}/cd_cc2_cs.hpp
${CC2_SRCDIR}/cd_cc2_os.hpp
)
4 changes: 2 additions & 2 deletions exachem/cc/cc2/cc2_canonical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* See LICENSE.txt for details
*/

#include "cc/ccsd/ccsd_util.hpp"
#include "cholesky/cholesky_2e_driver.hpp"
#include "exachem/cc/ccsd/ccsd_util.hpp"
#include "exachem/cholesky/cholesky_2e_driver.hpp"

using namespace tamm;
using namespace exachem::scf;
Expand Down
2 changes: 1 addition & 1 deletion exachem/cc/cc2/cd_cc2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* See LICENSE.txt for details
*/

#include "cc/cc2/cd_cc2_os.hpp"
#include "exachem/cc/cc2/cd_cc2.hpp"

#include <filesystem>
namespace fs = std::filesystem;
Expand Down
15 changes: 15 additions & 0 deletions exachem/cc/cc2/cd_cc2.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* ExaChem: Open Source Exascale Computational Chemistry Software.
*
* Copyright 2023-2024 Pacific Northwest National Laboratory, Battelle Memorial Institute.
*
* See LICENSE.txt for details
*/

#pragma once

#include "exachem/cc/cc2/cd_cc2_os.hpp"

namespace exachem::cc2 {
void cd_cc2_driver(ExecutionContext& ec, ChemEnv& chem_env);
} // namespace exachem::cc2
2 changes: 1 addition & 1 deletion exachem/cc/cc2/cd_cc2_cs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* See LICENSE.txt for details
*/

#include "cd_cc2_cs.hpp"
#include "exachem/cc/cc2/cd_cc2_cs.hpp"

namespace cc2_cs {

Expand Down
4 changes: 2 additions & 2 deletions exachem/cc/cc2/cd_cc2_cs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include "cc/ccsd/ccsd_util.hpp"
#include "exachem/cc/ccsd/ccsd_util.hpp"

using namespace tamm;

Expand Down Expand Up @@ -38,4 +38,4 @@ std::tuple<double, double> cd_cc2_cs_driver(
std::vector<Tensor<T>>& d_t2s, std::vector<T>& p_evl_sorted, Tensor<T>& cv3d, Tensor<T> dt1_full,
Tensor<T> dt2_full, bool cc2_restart = false, std::string out_fp = "", bool computeTData = false);

}; // namespace cc2_cs
}; // namespace cc2_cs
2 changes: 1 addition & 1 deletion exachem/cc/cc2/cd_cc2_os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* See LICENSE.txt for details
*/

#include "cd_cc2_os.hpp"
#include "exachem/cc/cc2/cd_cc2_os.hpp"

namespace cc2_os {

Expand Down
4 changes: 2 additions & 2 deletions exachem/cc/cc2/cd_cc2_os.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include "cd_cc2_cs.hpp"
#include "exachem/cc/cc2/cd_cc2_cs.hpp"

namespace cc2_os {

Expand Down Expand Up @@ -37,4 +37,4 @@ cd_cc2_os_driver(ChemEnv& chem_env, ExecutionContext& ec, const TiledIndexSpace&
std::vector<Tensor<T>>& d_t2s, std::vector<T>& p_evl_sorted, Tensor<T>& cv3d,
bool cc2_restart = false, std::string out_fp = "", bool computeTData = false);

}; // namespace cc2_os
}; // namespace cc2_os
2 changes: 1 addition & 1 deletion exachem/cc/ccsd/cd_ccsd_cs_ann.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* See LICENSE.txt for details
*/

#include "cd_ccsd_cs_ann.hpp"
#include "exachem/cc/ccsd/cd_ccsd_cs_ann.hpp"

using CCEType = double;
CCSE_Tensors<CCEType> _a021;
Expand Down
2 changes: 1 addition & 1 deletion exachem/cc/ccsd/cd_ccsd_os_ann.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* See LICENSE.txt for details
*/

#include "cd_ccsd_os_ann.hpp"
#include "exachem/cc/ccsd/cd_ccsd_os_ann.hpp"

using CCEType = double;
CCSE_Tensors<CCEType> _a021_os;
Expand Down
6 changes: 3 additions & 3 deletions exachem/cc/ccsd_t/ccsd_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/

// clang-format off
#include "cc/ccsd/cd_ccsd_os_ann.hpp"
#include "cc/ccsd_t/ccsd_t_fused_driver.hpp"
#include "cholesky/cholesky_2e_driver.hpp"
#include "exachem/cc/ccsd/cd_ccsd_os_ann.hpp"
#include "exachem/cc/ccsd_t/ccsd_t_fused_driver.hpp"
#include "exachem/cholesky/cholesky_2e_driver.hpp"
// clang-format on

double ccsdt_s1_t1_GetTime = 0;
Expand Down
4 changes: 2 additions & 2 deletions exachem/cc/ccsd_t/ccsd_t_all_fused_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
3rd. Generation Tensor Cores (FP64)
*/
// (1) Pure FP64
#include "ccsd_t_common.hpp"
#include "exachem/cc/ccsd_t/ccsd_t_common.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <vector>
Expand Down Expand Up @@ -125,7 +125,7 @@ __device__ inline void rt_load_fixed(double* smem, const int idx_x_1, const int
}
}

#include "ccsd_t_g2s_device_functions.cu"
#include "exachem/cc/ccsd_t/ccsd_t_g2s_device_functions.cu"

//------------------------------------------------------------------------------
// created by tc_gen_code_Kernel()
Expand Down
8 changes: 4 additions & 4 deletions exachem/cc/ducc/ducc-t_ccsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* See LICENSE.txt for details
*/

#include "cc/ccsd/cd_ccsd_os_ann.hpp"
#include "cholesky/v2tensors.hpp"
#include "exachem/cc/ducc/ducc-t_ccsd.hpp"
#include "exachem/cc/ccsd/cd_ccsd_os_ann.hpp"
#include "exachem/cc/ducc/ducc_fcidump.hpp"
#include <tamm/op_executor.hpp>

using namespace tamm;
Expand Down Expand Up @@ -539,8 +540,7 @@ namespace exachem::cc::ducc {
template<typename T>
void DUCC_T_CCSD_Driver(ChemEnv& chem_env, ExecutionContext& ec, const TiledIndexSpace& MO,
Tensor<T>& t1, Tensor<T>& t2, Tensor<T>& f1,
cholesky_2e::V2Tensors<T>& v2tensors, size_t nactv,
ExecutionHW ex_hw = ExecutionHW::CPU) {
cholesky_2e::V2Tensors<T>& v2tensors, size_t nactv, ExecutionHW ex_hw) {
Scheduler sch{ec};
SystemData& sys_data = chem_env.sys_data;

Expand Down
21 changes: 21 additions & 0 deletions exachem/cc/ducc/ducc-t_ccsd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* ExaChem: Open Source Exascale Computational Chemistry Software.
*
* Copyright 2023-2024 Pacific Northwest National Laboratory, Battelle Memorial Institute.
*
* See LICENSE.txt for details
*/

#pragma once

#include "exachem/cholesky/v2tensors.hpp"

namespace exachem::cc::ducc {
void ducc_driver(ExecutionContext& ec, ChemEnv& chem_env);

template<typename T>
void DUCC_T_CCSD_Driver(ChemEnv& chem_env, ExecutionContext& ec, const TiledIndexSpace& MO,
Tensor<T>& t1, Tensor<T>& t2, Tensor<T>& f1,
cholesky_2e::V2Tensors<T>& v2tensors, size_t nactv,
ExecutionHW ex_hw = ExecutionHW::CPU);
} // namespace exachem::cc::ducc
3 changes: 2 additions & 1 deletion exachem/cc/ducc/ducc.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

include(TargetMacros)

set(DUCC_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/../exachem/cc/ducc)
set(DUCC_SRCDIR cc/ducc)
set(DUCC_SRCS
${DUCC_SRCDIR}/ducc_driver.cpp
${DUCC_SRCDIR}/ducc-t_ccsd.cpp
)

set(DUCC_INCLUDES ${DUCC_SRCDIR}/ducc-t_ccsd.hpp)
9 changes: 3 additions & 6 deletions exachem/cc/ducc/ducc_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@
* See LICENSE.txt for details
*/

#include "cc/ccsd/cd_ccsd_os_ann.hpp"
#include "cholesky/cholesky_2e_driver.hpp"
#include "exachem/cc/ccsd/cd_ccsd_os_ann.hpp"
#include "exachem/cc/ducc/ducc-t_ccsd.hpp"
#include "exachem/cholesky/cholesky_2e_driver.hpp"

#include <filesystem>
namespace fs = std::filesystem;

namespace exachem::cc::ducc {
template<typename T>
void DUCC_T_CCSD_Driver(ChemEnv& chem_env, ExecutionContext& ec, const TiledIndexSpace& MO,
Tensor<T>& t1, Tensor<T>& t2, Tensor<T>& f1,
cholesky_2e::V2Tensors<T>& v2tensors, size_t nactv, ExecutionHW ex_hw);

void ducc_driver(ExecutionContext& ec, ChemEnv& chem_env) {
using T = double;
Expand Down
7 changes: 6 additions & 1 deletion exachem/cc/eom/eom.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@

include(TargetMacros)

set(CC_EOM_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/../exachem/cc/eom)
set(CC_EOM_SRCDIR cc/eom)
set(CC_EOM_SRCS
${CC_EOM_SRCDIR}/eomccsd_opt.cpp
${CC_EOM_SRCDIR}/eomccsd_driver.cpp
# ${CC_EOM_SRCDIR}/eomccsd.cpp
# ${CC_EOM_SRCDIR}/eom_gradients.cpp
)

set(CC_EOM_INCLUDES
${CC_EOM_SRCDIR}/eomccsd_opt.hpp
${CC_EOM_SRCDIR}/eomguess_opt.hpp
)

4 changes: 2 additions & 2 deletions exachem/cc/eom/eomccsd_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* See LICENSE.txt for details
*/

#include "cholesky/cholesky_2e_driver.hpp"
#include "eomccsd_opt.hpp"
#include "exachem/cc/eom/eomccsd_opt.hpp"
#include "exachem/cholesky/cholesky_2e_driver.hpp"
void exachem::cc::eom::eom_ccsd_driver(ExecutionContext& ec, ChemEnv& chem_env) {
using T = double;

Expand Down
2 changes: 1 addition & 1 deletion exachem/cc/eom/eomccsd_opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* See LICENSE.txt for details
*/

#include "eomccsd_opt.hpp"
#include "exachem/cc/eom/eomccsd_opt.hpp"

#include <filesystem>
namespace fs = std::filesystem;
Expand Down
2 changes: 1 addition & 1 deletion exachem/cc/eom/eomccsd_opt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include "eomguess_opt.hpp"
#include "exachem/cc/eom/eomguess_opt.hpp"

using namespace tamm;

Expand Down
2 changes: 1 addition & 1 deletion exachem/cc/eom/eomguess_opt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include "cc/ccsd/cd_ccsd_os_ann.hpp"
#include "exachem/cc/ccsd/cd_ccsd_os_ann.hpp"
#include <algorithm>
#include <complex>
using namespace tamm;
Expand Down
5 changes: 4 additions & 1 deletion exachem/cc/gfcc/gfcc.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

include(TargetMacros)

set(GFCC_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/../exachem/cc/gfcc)
set(GFCC_SRCDIR cc/gfcc)
set(GFCC_SRCS
${GFCC_SRCDIR}/gfccsd_driver.cpp
)
set(GFCC_INCLUDES
${GFCC_SRCDIR}/gfccsd.hpp
)

14 changes: 14 additions & 0 deletions exachem/cc/gfcc/gfccsd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* ExaChem: Open Source Exascale Computational Chemistry Software.
*
* Copyright 2023-2024 Pacific Northwest National Laboratory, Battelle Memorial Institute.
*
* See LICENSE.txt for details
*/

#pragma once
#include "exachem/common/chemenv.hpp"

namespace exachem::cc::gfcc {
void gfccsd_driver(ExecutionContext& ec, ChemEnv& chem_env);
};
4 changes: 2 additions & 2 deletions exachem/cc/gfcc/gfccsd_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* See LICENSE.txt for details
*/

#include "cc/lambda/ccsd_lambda.hpp"
#include "cholesky/cholesky_2e_driver.hpp"
#include "exachem/cc/lambda/ccsd_lambda.hpp"
#include "exachem/cholesky/cholesky_2e_driver.hpp"
#include "gf_diis.hpp"
#include "gf_guess.hpp"
#include "gfccsd_ea.hpp"
Expand Down
2 changes: 1 addition & 1 deletion exachem/cc/lambda/ccsd_lambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* See LICENSE.txt for details
*/

#include "ccsd_lambda.hpp"
#include "exachem/cc/lambda/ccsd_lambda.hpp"

void exachem::cc::ccsd_lambda::iteration_print_lambda(ChemEnv& chem_env, const ProcGroup& pg,
int iter, double residual, double time) {
Expand Down
2 changes: 1 addition & 1 deletion exachem/cc/lambda/ccsd_lambda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include "cc/ccsd/cd_ccsd_os_ann.hpp"
#include "exachem/cc/ccsd/cd_ccsd_os_ann.hpp"
#include "exachem/scf/scf_main.hpp"

using namespace tamm;
Expand Down
Loading

0 comments on commit 8f3bf0a

Please sign in to comment.