Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
72 changes: 37 additions & 35 deletions source/source_base/global_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <cerrno>
#include <sstream>
#include "global_function.h"
#include "source_io/module_parameter/parameter.h"
#include "global_variable.h"
#include "source_base/parallel_common.h"
#include "source_base/parallel_reduce.h"
Expand All @@ -31,7 +30,16 @@ void ModuleBase::Global_File::make_dir_out(
const bool &out_wfc_dir,
const int rank,
const bool &restart,
const bool out_alllog)
const bool out_alllog,
const std::string &global_out_dir,
const std::string &global_stru_dir,
const std::string &global_matrix_dir,
const std::string &global_wfc_dir,
const std::string &global_mlkedf_descriptor_dir,
const std::string &global_deepks_label_elec_dir,
const std::string &log_file,
const bool of_ml_gene_data,
const bool deepks_out_freq_elec)
{
//----------------------------------------------------------
// USE STL FUNCTION
Expand All @@ -43,17 +51,16 @@ void ModuleBase::Global_File::make_dir_out(
#endif
int make_dir = 0;
// mohan update 2011-05-03
//std::string command0 = "test -d " + PARAM.globalv.global_out_dir + " || mkdir " + PARAM.globalv.global_out_dir;

int times = 0;
while(times<GlobalV::NPROC)
{
if(rank==times)
{
int ret = mkdir(PARAM.globalv.global_out_dir.c_str(), 0755);
int ret = mkdir(global_out_dir.c_str(), 0755);
if ( ret == 0 || errno == EEXIST )
{
std::cout << " MAKE THE DIR : " << PARAM.globalv.global_out_dir << std::endl;
std::cout << " MAKE THE DIR : " << global_out_dir << std::endl;
make_dir = 1;
}
else
Expand Down Expand Up @@ -82,17 +89,16 @@ void ModuleBase::Global_File::make_dir_out(
if(calculation == "md")
{
int make_dir_stru = 0;
//std::string command1 = "test -d " + PARAM.globalv.global_stru_dir + " || mkdir " + PARAM.globalv.global_stru_dir;

times = 0;
while(times<GlobalV::NPROC)
{
if(rank==times)
{
int ret = mkdir(PARAM.globalv.global_stru_dir.c_str(), 0755);
int ret = mkdir(global_stru_dir.c_str(), 0755);
if ( ret == 0 || errno == EEXIST )
{
std::cout << " MAKE THE STRU DIR : " << PARAM.globalv.global_stru_dir << std::endl;
std::cout << " MAKE THE STRU DIR : " << global_stru_dir << std::endl;
make_dir_stru = 1;
}
else
Expand Down Expand Up @@ -123,17 +129,16 @@ void ModuleBase::Global_File::make_dir_out(
if((out_dir) && calculation == "md")
{
int make_dir_matrix = 0;
//std::string command1 = "test -d " + PARAM.globalv.global_matrix_dir + " || mkdir " + PARAM.globalv.global_matrix_dir;

times = 0;
while(times<GlobalV::NPROC)
{
if(rank==times)
{
int ret = mkdir(PARAM.globalv.global_matrix_dir.c_str(), 0755);
int ret = mkdir(global_matrix_dir.c_str(), 0755);
if ( ret == 0 || errno == EEXIST )
{
std::cout << " MAKE THE MATRIX DIR : " << PARAM.globalv.global_matrix_dir << std::endl;
std::cout << " MAKE THE MATRIX DIR : " << global_matrix_dir << std::endl;
make_dir_matrix = 1;
}
else
Expand Down Expand Up @@ -163,17 +168,16 @@ void ModuleBase::Global_File::make_dir_out(
if(out_wfc_dir)
{
int make_dir_wfc = 0;
//std::string command1 = "test -d " + PARAM.globalv.global_wfc_dir + " || mkdir " + PARAM.globalv.global_wfc_dir;

times = 0;
while(times<GlobalV::NPROC)
{
if(rank==times)
{
int ret = mkdir(PARAM.globalv.global_wfc_dir.c_str(), 0755);
int ret = mkdir(global_wfc_dir.c_str(), 0755);
if ( ret == 0 || errno == EEXIST )
{
std::cout << " MAKE THE WFC DIR : " << PARAM.globalv.global_wfc_dir << std::endl;
std::cout << " MAKE THE WFC DIR : " << global_wfc_dir << std::endl;
make_dir_wfc = 1;
}
else
Expand All @@ -200,20 +204,19 @@ void ModuleBase::Global_File::make_dir_out(
#endif
}

if(PARAM.inp.of_ml_gene_data == 1)
if(of_ml_gene_data)
{
int make_dir_descrip = 0;
//std::string command1 = "test -d " + PARAM.globalv.global_mlkedf_descriptor_dir + " || mkdir " + PARAM.globalv.global_mlkedf_descriptor_dir;

times = 0;
while(times<GlobalV::NPROC)
{
if(rank==times)
{
int ret = mkdir(PARAM.globalv.global_mlkedf_descriptor_dir.c_str(), 0755);
int ret = mkdir(global_mlkedf_descriptor_dir.c_str(), 0755);
if ( ret == 0 || errno == EEXIST )
{
std::cout << " MAKE THE MLKEDF DESCRIPTOR DIR : " << PARAM.globalv.global_mlkedf_descriptor_dir << std::endl;
std::cout << " MAKE THE MLKEDF DESCRIPTOR DIR : " << global_mlkedf_descriptor_dir << std::endl;
make_dir_descrip = 1;
}
else
Expand All @@ -226,7 +229,7 @@ void ModuleBase::Global_File::make_dir_out(
Parallel_Reduce::reduce_all(make_dir_descrip);
#endif
if(make_dir_descrip > 0)
{
{
break;
}
++times;
Expand All @@ -242,20 +245,19 @@ void ModuleBase::Global_File::make_dir_out(
#endif
}

if(PARAM.inp.deepks_out_freq_elec > 0)
if(deepks_out_freq_elec)
{
int make_dir_deepks_elec = 0;
//std::string command1 = "test -d " + PARAM.globalv.global_deepks_label_elec_dir + " || mkdir " + PARAM.globalv.global_deepks_label_elec_dir;

times = 0;
while(times<GlobalV::NPROC)
{
if(rank==times)
{
int ret = mkdir(PARAM.globalv.global_deepks_label_elec_dir.c_str(), 0755);
int ret = mkdir(global_deepks_label_elec_dir.c_str(), 0755);
if ( ret == 0 || errno == EEXIST )
{
std::cout << " MAKE THE DEEPKS LABELS (ELEC) DIR : " << PARAM.globalv.global_deepks_label_elec_dir << std::endl;
std::cout << " MAKE THE DEEPKS LABELS (ELEC) DIR : " << global_deepks_label_elec_dir << std::endl;
make_dir_deepks_elec = 1;
}
else
Expand All @@ -268,7 +270,7 @@ void ModuleBase::Global_File::make_dir_out(
Parallel_Reduce::reduce_all(make_dir_deepks_elec);
#endif
if(make_dir_deepks_elec > 0)
{
{
break;
}
++times;
Expand All @@ -287,53 +289,53 @@ void ModuleBase::Global_File::make_dir_out(
// mohan add 2010-09-12
if(out_alllog)
{
open_log(GlobalV::ofs_running, PARAM.globalv.log_file, calculation, restart);
open_log(GlobalV::ofs_running, log_file, calculation, restart, global_out_dir);
#if defined(__CUDA) || defined(__ROCM)
open_log(GlobalV::ofs_device, "device" + std::to_string(rank) + ".log", calculation, restart);
open_log(GlobalV::ofs_device, "device" + std::to_string(rank) + ".log", calculation, restart, global_out_dir);
#endif
}
else
{
if(rank==0)
{
open_log(GlobalV::ofs_running, PARAM.globalv.log_file, calculation, restart);
open_log(GlobalV::ofs_running, log_file, calculation, restart, global_out_dir);
#if defined(__CUDA) || defined(__ROCM)
open_log(GlobalV::ofs_device, "device.log", calculation, restart);
open_log(GlobalV::ofs_device, "device.log", calculation, restart, global_out_dir);
#endif
}
}

if(rank==0)
{
open_log(GlobalV::ofs_warning, "warning.log", calculation, restart);
open_log(GlobalV::ofs_warning, "warning.log", calculation, restart, global_out_dir);
}

#ifdef GATHER_INFO
open_log(GlobalV::ofs_info, "math_info_" + std::to_string(rank) + ".log", calculation, restart);
open_log(GlobalV::ofs_info, "math_info_" + std::to_string(rank) + ".log", calculation, restart, global_out_dir);
#endif

return;
}

void ModuleBase::Global_File::make_dir_atom(const std::string &label)
void ModuleBase::Global_File::make_dir_atom(const std::string &label, const std::string &global_out_dir)
{
//----------------------------------------------------------
// EXPLAIN : generate atom dir for each type of atom
//----------------------------------------------------------
std::stringstream ss;
ss << PARAM.globalv.global_out_dir << label << "/";
ss << global_out_dir << label << "/";
ModuleBase::GlobalFunc::MAKE_DIR(ss.str());
return;
}

void ModuleBase::Global_File::open_log(std::ofstream &ofs, const std::string &fn, const std::string &calculation, const bool &restart)
void ModuleBase::Global_File::open_log(std::ofstream &ofs, const std::string &fn, const std::string &calculation, const bool &restart, const std::string &global_out_dir)
{
//----------------------------------------------------------
// USE GLOBAL VARIABLE :
// PARAM.globalv.global_out_dir : (default dir to store "*.log" file)
// global_out_dir : (default dir to store "*.log" file)
//----------------------------------------------------------
std::stringstream ss;
ss << PARAM.globalv.global_out_dir << fn;
ss << global_out_dir << fn;

if(calculation == "md" && restart)
{
Expand Down
17 changes: 13 additions & 4 deletions source/source_base/global_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,19 @@ namespace Global_File
const bool &out_wfc_dir,
const int rank,
const bool &restart,
const bool out_alllog = false);

void make_dir_atom(const std::string &label);
void open_log ( std::ofstream &ofs, const std::string &fn, const std::string &calculation, const bool &restart);
const bool out_alllog,
const std::string &global_out_dir,
const std::string &global_stru_dir,
const std::string &global_matrix_dir,
const std::string &global_wfc_dir,
const std::string &global_mlkedf_descriptor_dir,
const std::string &global_deepks_label_elec_dir,
const std::string &log_file,
const bool of_ml_gene_data,
const bool deepks_out_freq_elec);

void make_dir_atom(const std::string &label, const std::string &global_out_dir);
void open_log ( std::ofstream &ofs, const std::string &fn, const std::string &calculation, const bool &restart, const std::string &global_out_dir);
void close_log( std::ofstream &ofs, const std::string &fn);
void close_all_log(const int rank, const bool out_alllog = false, const std::string& calculation = "md");
}
Expand Down
1 change: 0 additions & 1 deletion source/source_base/kernels/cuda/math_kernel_op.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "source_base/module_device/memory_op.h"
#include "source_base/kernels/math_kernel_op.h"
#include "source_psi/psi.h"
#include "source_base/tool_quit.h"
#include "source_base/module_container/base/third_party/cublas.h"

Expand Down
1 change: 0 additions & 1 deletion source/source_base/kernels/rocm/math_kernel_op.hip.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "source_base/module_device/memory_op.h"
#include "source_base/kernels/math_kernel_op.h"
#include "source_psi/psi.h"
#include "source_base/tool_quit.h"

#include <base/macros/macros.h>
Expand Down
35 changes: 0 additions & 35 deletions source/source_base/parallel_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "source_base/parallel_reduce.h"
#include "source_base/global_variable.h"
#include "source_base/tool_quit.h"
#include "source_main/version.h"

#include <iostream>
#include <thread>
Expand Down Expand Up @@ -175,40 +174,6 @@ void Parallel_Global::read_pal_param(int argc,

NTHREAD_PER_PROC = current_thread_num;

if (MY_RANK == 0)
{
#ifdef VERSION
const char* version = VERSION;
#else
const char* version = "unknown";
#endif
#ifdef COMMIT_INFO
#include "commit.h"
const char* commit = COMMIT;
#else
const char* commit = "unknown";
#endif
std::cout << " "
<< std::endl
<< " ABACUS " << version << std::endl
<< std::endl
<< " Atomic-orbital Based Ab-initio Computation at UStc "
<< std::endl
<< std::endl
<< " Website: http://abacus.ustc.edu.cn/ "
<< std::endl
<< " Documentation: https://abacus.deepmodeling.com/ "
<< std::endl
<< " Repository: https://github.com/abacusmodeling/abacus-develop "
<< std::endl
<< " https://github.com/deepmodeling/abacus-develop "
<< std::endl
<< " Commit: " << commit << std::endl
<< std::endl;
time_t time_now = time(nullptr);
std::cout << " " << ctime(&time_now);
}

// for test
/*
for (int i=0; i<NPROC; i++)
Expand Down
Loading
Loading