Skip to content

Commit

Permalink
core: replace iostream by runtimeErrorMsg()
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed May 1, 2020
1 parent d82b49d commit 09294e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
22 changes: 5 additions & 17 deletions src/core/actor/DipolarBarnesHut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
#include "errorhandling.hpp"
#include "grid.hpp"

#include <cstdio>
#include <iostream>

#ifndef ACTOR_DIPOLARBARNESHUT_HPP
#define ACTOR_DIPOLARBARNESHUT_HPP

Expand All @@ -47,16 +44,13 @@ class DipolarBarnesHut : public Actor {
m_itolsq = itolsq;
setBHPrecision(&m_epssq, &m_itolsq);
if (!s.requestFGpu())
std::cerr << "DipolarBarnesHut needs access to forces on GPU!"
<< std::endl;
runtimeErrorMsg() << "DipolarBarnesHut needs access to forces on GPU!";

if (!s.requestRGpu())
std::cerr << "DipolarBarnesHut needs access to positions on GPU!"
<< std::endl;
runtimeErrorMsg() << "DipolarBarnesHut needs access to positions on GPU!";

if (!s.requestDipGpu())
std::cerr << "DipolarBarnesHut needs access to dipoles on GPU!"
<< std::endl;
runtimeErrorMsg() << "DipolarBarnesHut needs access to dipoles on GPU!";
};

void computeForces(SystemInterface &s) override {
Expand All @@ -69,10 +63,7 @@ class DipolarBarnesHut : public Actor {
summarizeBH(m_bh_data.blocks);
sortBH(m_bh_data.blocks);
if (forceBH(&m_bh_data, k, s.fGpuBegin(), s.torqueGpuBegin())) {
fprintf(
stderr,
"forceBH: some of kernels encounter the algorithm functional error");
errexit();
runtimeErrorMsg() << "kernels encountered a functional error";
}
};
void computeEnergy(SystemInterface &s) override {
Expand All @@ -85,10 +76,7 @@ class DipolarBarnesHut : public Actor {
summarizeBH(m_bh_data.blocks);
sortBH(m_bh_data.blocks);
if (energyBH(&m_bh_data, k, (&(((CUDA_energy *)s.eGpu())->dipolar)))) {
fprintf(
stderr,
"energyBH: some of kernels encounter the algorithm functional error");
errexit();
runtimeErrorMsg() << "kernels encountered a functional error";
}
};

Expand Down
11 changes: 4 additions & 7 deletions src/core/actor/DipolarDirectSum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include "SystemInterface.hpp"
#include "cuda_interface.hpp"
#include "electrostatics_magnetostatics/dipole.hpp"
#include "errorhandling.hpp"
#include "grid.hpp"

#include <iostream>
#include <memory>

#ifndef ACTOR_DIPOLARDIRECTSUM_HPP
Expand All @@ -50,16 +50,13 @@ class DipolarDirectSum : public Actor {
k = static_cast<float>(dipole.prefactor);

if (!s.requestFGpu())
std::cerr << "DipolarDirectSum needs access to forces on GPU!"
<< std::endl;
runtimeErrorMsg() << "DipolarDirectSum needs access to forces on GPU!";

if (!s.requestRGpu())
std::cerr << "DipolarDirectSum needs access to positions on GPU!"
<< std::endl;
runtimeErrorMsg() << "DipolarDirectSum needs access to positions on GPU!";

if (!s.requestDipGpu())
std::cerr << "DipolarDirectSum needs access to dipoles on GPU!"
<< std::endl;
runtimeErrorMsg() << "DipolarDirectSum needs access to dipoles on GPU!";
};
void computeForces(SystemInterface &s) override {
dds_float box[3];
Expand Down
2 changes: 1 addition & 1 deletion src/core/grid_based_algorithms/electrokinetics_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,7 @@ int ek_init() {
try {
electrostatics = new FdElectrostatics(es_parameters, stream[0]);
} catch (std::string e) {
std::cout << "Error in initialization of electrokinetics electrostatics "
std::cerr << "Error in initialization of electrokinetics electrostatics "
"solver: "
<< e << std::endl;
return 1;
Expand Down

0 comments on commit 09294e7

Please sign in to comment.