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
2 changes: 1 addition & 1 deletion src/BlockVector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void BlockVector<ScalarType, MemorySpaceType>::allocate_storage()
std::cerr << "ERROR BlockVector: trying to use allocation "
<< size_storage_ << " bigger than initialy preallocated "
<< allocated_size_storage_ << "!!!" << std::endl;
ct.global_exit(0);
ct.global_exit();
}
storage_ = class_storage_[my_allocation_];
assert(class_storage_.size() > 0);
Expand Down
18 changes: 9 additions & 9 deletions src/Control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ void Control::sync(void)
if (mpirc != MPI_SUCCESS)
{
(*MPIdata::sout) << "MPI Bcast of Control failed!!!" << std::endl;
MPI_Abort(comm_global_, 2);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
};

Expand Down Expand Up @@ -1152,7 +1152,7 @@ void Control::setTolEigenvalueGram(const float tol)
<< threshold_eigenvalue_gram_ << std::endl;
}

void Control::global_exit(int i) { MPI_Abort(comm_global_, i); }
void Control::global_exit() { MPI_Abort(comm_global_, EXIT_FAILURE); }

void Control::setSpecies(Potentials& pot)
{
Expand Down Expand Up @@ -1342,7 +1342,7 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
(*MPIdata::serr)
<< "ERROR in Control::setOptions: Invalid restart dump type"
<< std::endl;
MPI_Abort(comm_global_, 2);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

(*MPIdata::sout) << "Output restart file: " << out_restart_file
Expand Down Expand Up @@ -1549,14 +1549,14 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
else
{
std::cerr << "ERROR: Spread Penalty needs a type" << std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

if (spread_penalty_target_ <= 0.)
{
(*MPIdata::sout) << "Invalid value for Spread Penalty target: "
<< spread_penalty_target_ << std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
}

Expand Down Expand Up @@ -1599,7 +1599,7 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
{
(*MPIdata::sout) << "Invalid value for Thermostat.type: "
<< thermostat_type << std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

tkel = vm["Thermostat.temperature"].as<float>();
Expand All @@ -1608,15 +1608,15 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
(*MPIdata::sout)
<< "Invalid value for Thermostat.temperature: " << tkel
<< std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
thtime = vm["Thermostat.relax_time"].as<float>();
if (thtime < 0.)
{
(*MPIdata::sout)
<< "Invalid value for Thermostat.relax_time: " << thtime
<< std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

if (str.compare("SCALING") == 0)
Expand All @@ -1627,7 +1627,7 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
(*MPIdata::sout)
<< "Invalid value for Thermostat.width: " << thwidth
<< std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class Control
return pair_mlwf_distance_threshold_;
}

void global_exit(int i);
void global_exit();

bool Mehrstellen() const { return (lap_type == 0 || lap_type == 10); }

Expand Down
10 changes: 5 additions & 5 deletions src/DistMatrix/BlacsContext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ BlacsContext::BlacsContext(
{
std::cerr << " BlacsContext::BlacsContext: type = " << type
<< " is an incorrect parameter" << std::endl;
MPI_Abort(comm_global, 0);
MPI_Abort(comm_global, EXIT_FAILURE);
}

size_ = nprow_ * npcol_;
Expand Down Expand Up @@ -222,7 +222,7 @@ BlacsContext::BlacsContext(
{
std::cerr << " nprocs_=" << nprocs_ << std::endl;
std::cerr << " BlacsContext nprow*npcol > nprocs_" << std::endl;
MPI_Abort(comm_global, 0);
MPI_Abort(comm_global, EXIT_FAILURE);
}

ictxt_ = Csys2blacs_handle(comm_global_);
Expand Down Expand Up @@ -252,7 +252,7 @@ BlacsContext::BlacsContext(
{
std::cerr << " BlacsContext::BlacsContext: invalid parameters"
<< " in " << __FILE__ << ":" << __LINE__ << std::endl;
MPI_Abort(comm_global, 0);
MPI_Abort(comm_global, EXIT_FAILURE);
}
int* pmap = new int[nprow * npcol];
// build pmap
Expand Down Expand Up @@ -296,7 +296,7 @@ BlacsContext::BlacsContext(BlacsContext& bc, const int irow, const int icol,
{
std::cerr << " BlacsContext::BlacsContext: invalid parameters"
<< std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
int* pmap = new int[nprow * npcol];
// build pmap
Expand Down Expand Up @@ -350,7 +350,7 @@ BlacsContext::BlacsContext(const BlacsContext& bc, const char type)
std::cerr
<< " BlacsContext::BlacsContext: row/col incorrect parameter: "
<< type << std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

ictxt_ = Csys2blacs_handle(comm_global_);
Expand Down
2 changes: 1 addition & 1 deletion src/DistMatrix/DistMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
std::cerr << "ERROR in file " << __FILE__ << " at line " << __LINE__ \
<< std::endl; \
std::cerr << "Error Message: " << X << std::endl; \
MPI_Abort(comm_global_, 2);
MPI_Abort(comm_global_, EXIT_FAILURE);

#endif

Expand Down
2 changes: 1 addition & 1 deletion src/DistanceConstraint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool DistanceConstraint::enforce(void)
{
cerr << "mype=" << mype << ", tau1p_[0]=" << tau1p_[0] << endl;
cerr << "mype=" << mype << ", tau2p_[0]=" << tau2p_[0] << endl;
MPI_Abort(MPI_COMM_WORLD, 0);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
}
if (locally_owned_)
(*MPIdata::sout) << setprecision(8) << "DistanceConstraint, d=" << d
Expand Down
2 changes: 1 addition & 1 deletion src/ExtendedGridOrbitals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ double ExtendedGridOrbitals::dotProduct(
"dot product type"
<< std::endl;
Control& ct = *(Control::instance());
ct.global_exit(2);
ct.global_exit();
}

dot_product_tm_.stop();
Expand Down
2 changes: 1 addition & 1 deletion src/IonicAlgorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void IonicAlgorithm<OrbitalsType>::init(HDFrestart* h5f_file)
if (ct.restart_info > 0)
{
int status = stepper_->init(*h5f_file);
if (status < 0) ct.global_exit(2);
if (status < 0) ct.global_exit();

// if restart data for lbfgs found
if (status == 0)
Expand Down
3 changes: 1 addition & 2 deletions src/Ions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,6 @@ int Ions::read1atom(std::ifstream* tfile, const bool cell_relative)
double velocity[3] = { 0., 0., 0. };

MGmol_MPI& mmpi(*(MGmol_MPI::instance()));
Control& ct(*(Control::instance()));

short movable = 0;
std::string query;
Expand Down Expand Up @@ -2005,7 +2004,7 @@ int Ions::read1atom(std::ifstream* tfile, const bool cell_relative)
{
std::cerr << "ERROR: Invalid name read in input file: " << name_read
<< std::endl;
ct.global_exit(2);
mmpi.abort();
}
short dummy;
ss >> dummy; // not used anymore (was species index)
Expand Down
3 changes: 1 addition & 2 deletions src/LDAFunctional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ double LDAFunctional::computeRhoDotExc() const
if (rc != MPI_SUCCESS)
{
(*MPIdata::sout) << "MPI_Allreduce double sum failed!!!" << endl;
Control& ct = *(Control::instance());
ct.global_exit(2);
mmpi.abort();
}
exc = (POTDTYPE)sum;
return exc;
Expand Down
20 changes: 5 additions & 15 deletions src/LocalizationRegions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ void LocalizationRegions::bcastLRs()
cerr << "ERROR!!!! LocalizationRegions::bcast(), Failure in MPI_Bcast "
"of 'nglobal_'!!!"
<< endl;
MPI_Abort(comm, 0);
MPI_Abort(comm, EXIT_FAILURE);
}

if (nglobal_ == 0) return;
Expand Down Expand Up @@ -522,7 +522,7 @@ void LocalizationRegions::bcastLRs()
cerr << "ERROR!!!! LocalizationRegions::bcast(), Failure in "
"MPI_Bcast of 'centers'!!!"
<< endl;
MPI_Abort(comm, 0);
MPI_Abort(comm, EXIT_FAILURE);
}
vector<LRData>::iterator it = all_regions_.begin();
int i = 0;
Expand Down Expand Up @@ -554,7 +554,7 @@ void LocalizationRegions::bcastLRs()
cerr << "ERROR!!!! LocalizationRegions::bcast(), Failure in "
"MPI_Bcast of 'radius'!!!"
<< endl;
MPI_Abort(comm, 0);
MPI_Abort(comm, EXIT_FAILURE);
}
it = all_regions_.begin();
i = 0;
Expand Down Expand Up @@ -642,7 +642,7 @@ void LocalizationRegions::bcastLRs()
cerr << "ERROR!!!! LocalizationRegions::bcast(), Failure in MPI_Bcast "
"of 'volume'!!!"
<< endl;
MPI_Abort(comm, 0);
MPI_Abort(comm, EXIT_FAILURE);
}
if (ct.verbose > 0)
printWithTimeStamp("LocalizationRegions::bcast() done...", cout);
Expand Down Expand Up @@ -915,19 +915,9 @@ void LocalizationRegions::setupLocalRegionsFromOverlapRegions()
cerr << "ERROR in distribution of localization centers: count=" << count
<< endl;
cerr << "global number of regions=" << nglobal_ << endl;
MPI_Abort(MPI_COMM_WORLD, 1);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
}

#if 0
//if(onpe0)
if( count!=nglobal_ )
{
cerr<<"ERROR in distribution of localization centers: count="<<count
<<", regions_.size()="<<regions_.size()
<<endl;
MPI_Abort(MPI_COMM_WORLD,1);
}
#endif
gid_local_regions_set_ = true;
setupLocalRegionsFromOverlapRegions_tm_.stop();
}
Expand Down
6 changes: 3 additions & 3 deletions src/LocalizationRegions.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class LocalizationRegions
std::cout << "mype:" << mype
<< ", WARNING: didn't find a center for gid=" << gid
<< std::endl;
MPI_Abort(MPI_COMM_WORLD, 0);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
return (overlap_regions_.end())->center;
}

Expand All @@ -261,7 +261,7 @@ class LocalizationRegions
std::cout << "mype:" << mype
<< ", WARNING: didn't find a color for gid=" << gid
<< std::endl;
MPI_Abort(MPI_COMM_WORLD, 0);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
return -1;
}

Expand All @@ -284,7 +284,7 @@ class LocalizationRegions
std::cout << "mype:" << mype
<< ", WARNING: didn't find a center and radius for gid="
<< gid << std::endl;
MPI_Abort(MPI_COMM_WORLD, 0);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);

center = (overlap_regions_.end())->center;
return (overlap_regions_.end())->radius;
Expand Down
11 changes: 6 additions & 5 deletions src/MDfiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ void MDfiles::printDataInFiles(vector<string>& ions_names, vector<double>& tau,
ofstream tfile(coord_dir_name.data(), ios::out);
if (!tfile.is_open())
{
cerr << " Unable to open file " << coord_dir_name.data()
<< endl;
ct.global_exit(0);
std::cerr << " Unable to open file " << coord_dir_name.data()
<< endl;
ct.global_exit();
}
// cout<<"recvbuf.size()="<<recvbuf.size()<<endl;
// tfile<<"recvbuf.size()="<<recvbuf.size()<<endl;
Expand Down Expand Up @@ -279,8 +279,9 @@ void MDfiles::printDataInFiles(vector<string>& ions_names, vector<double>& tau,
ofstream tfile2(wf_dir_name.data(), ios::out);
if (!tfile2.is_open())
{
cerr << " Unable to open file " << wf_dir_name.data() << endl;
ct.global_exit(0);
std::cerr << " Unable to open file " << wf_dir_name.data()
<< std::endl;
ct.global_exit();
}
const int na = recvbufspreads.size();
for (int i = 0; i < na; i++)
Expand Down
15 changes: 6 additions & 9 deletions src/MGmol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -728,12 +728,6 @@ void MGmol<OrbitalsType>::write_header()
if (ct.isLocMode() && ct.verbose > 3) lrs_->printAllRegions(os_);
}

template <class OrbitalsType>
void MGmol<OrbitalsType>::global_exit(int i)
{
MPI_Abort(comm_, i);
}

template <class OrbitalsType>
void MGmol<OrbitalsType>::check_anisotropy()
{
Expand All @@ -748,7 +742,8 @@ void MGmol<OrbitalsType>::check_anisotropy()
<< ", hmin=" << mygrid.hmin() << std::endl;
(*MPIdata::serr) << "init: Anisotropy too large: "
<< mygrid.anisotropy() << std::endl;
global_exit(2);
MGmol_MPI& mmpi = *(MGmol_MPI::instance());
mmpi.abort();
}
}

Expand Down Expand Up @@ -1046,7 +1041,8 @@ void MGmol<OrbitalsType>::setup()
total_tm_.start();
setup_tm_.start();

Control& ct = *(Control::instance());
Control& ct = *(Control::instance());
MGmol_MPI& mmpi = *(MGmol_MPI::instance());

if (ct.verbose > 0)
printWithTimeStamp("MGmol<OrbitalsType>::setup()...", os_);
Expand All @@ -1064,7 +1060,8 @@ void MGmol<OrbitalsType>::setup()
#else
int ierr = initial<MemorySpace::Host>();
#endif
if (ierr < 0) global_exit(0);

if (ierr < 0) mmpi.abort();

// Write header to stdout
write_header();
Expand Down
1 change: 0 additions & 1 deletion src/MGmol.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ class MGmol : public MGmolInterface
void initNuc(Ions& ions);
void initKBR();

void global_exit(int i);
void printEigAndOcc();

int readCoordinates(std::ifstream* tfile, const bool cell_relative);
Expand Down
2 changes: 1 addition & 1 deletion src/NonOrthoDMStrategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int NonOrthoDMStrategy<OrbitalsType>::update(OrbitalsType& orbitals)
{
std::cerr << "NonOrthoDMStrategy, Invalid mixing value: " << mix_
<< std::endl;
MPI_Abort(mmpi.commSameSpin(), 0);
MPI_Abort(mmpi.commSameSpin(), EXIT_FAILURE);
}

if (mmpi.PE0() && ct.verbose > 2)
Expand Down
3 changes: 1 addition & 2 deletions src/PBEFunctional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ double PBEFunctional::computeRhoDotExc() const
if (rc != MPI_SUCCESS)
{
(*MPIdata::sout) << "MPI_Allreduce double sum failed!!!" << std::endl;
Control& ct = *(Control::instance());
ct.global_exit(2);
mmpi.abort();
}
exc = sum;
return exc;
Expand Down
Loading