Changeset 6294b6


Ignore:
Timestamp:
Aug 11, 2025, 5:43:56 PM (5 months ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, Candidate_v1.7.1, stable
Children:
c41ce0
Parents:
c099dc
git-author:
Frederik Heber <frederik.heber@…> (05/02/24 22:20:01)
git-committer:
Frederik Heber <frederik.heber@…> (08/11/25 17:43:56)
Message:

MPQCJob mutes output on verbosity level 0 and unmutes else.

  • we redirect stdout to /dev/null when verbose level of 0 is set.
  • passing on verbosity level to MPQCJob.
  • Tested that the verbosity can be changed per executed job and will not be touched with a job of the same verbosity level.
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • ThirdParty/mpqc_open/src/bin/mpqc/mpqc.cc

    rc099dc r6294b6  
    11771177}
    11781178
     1179//!> this is backup for the old ExEnv::out0 stream when we override using /dev/null
     1180ostream *oldstream = NULL;
     1181
    11791182/** Performs the main work to calculate the ground state energies, gradients, etc.
    11801183 *
     
    11931196  // get the basename for output files
    11941197  setOutputBaseName(_initvalues.input, _initvalues.output);
     1198
     1199  // Based on verbose flag in InitValues, out ExEnv::set_out to nullstream (see out0()) to mute info
     1200  ofstream nullofstream;
     1201  if (_initvalues.verbose == 0) {
     1202    // only change out0 when oldstream is unset, yet
     1203    if (oldstream == NULL) {
     1204      ExEnv::out0() << "Muting mpqc's output due to verbosity level of 0." << endl;
     1205      nullofstream.open("/dev/null");
     1206      oldstream = &ExEnv::out0();
     1207      ExEnv::set_out(&nullofstream);
     1208    }
     1209  } else {
     1210    // only revert out0 if oldstream is set, i.e., when it has been changed
     1211    if (oldstream != NULL) {
     1212      ExEnv::out0() << "Unmuting mpqc's output due to verbosity level of 1 or larger." << endl;
     1213      ExEnv::set_out(oldstream);
     1214      oldstream = NULL;
     1215    }
     1216  }
    11951217
    11961218  // parse input into keyvalue container
     
    14771499      outstream(NULL),
    14781500      in_char_array(NULL),
    1479       values(::values)
     1501      values(::values),
     1502      verbose(0)
    14801503  {};
    14811504
  • ThirdParty/mpqc_open/src/bin/mpqc/mpqc.h

    rc099dc r6294b6  
    5959    sc::GetLongOpt options;
    6060    sc::Ref< sc::MessageGrp> grp;
     61    int verbose;
    6162  };
    6263
  • src/Actions/CommandAction/VerboseAction.cpp

    rc099dc r6294b6  
    5858    // set new verbosity
    5959    setVerbosity(params.verbosity.get());
    60     LOG(0, "Setting verbosity from " << oldverbosity << " to " << params.verbosity.get() << ".");
     60    LOG(0, "Setting verbosity from " << oldverbosity << " to " << getVerbosity() << ".");
    6161  } else {
    6262    LOG(0, "Verbosity remains unchanged at " << oldverbosity << ".");
  • src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    rc099dc r6294b6  
    250250    const bool AddJobsStatus = mpqccontroller.addJobsFromQueue(
    251251        params.DoLongrange.get() ? MPQCData::DoSampleDensity : MPQCData::DontSampleDensity,
    252         params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly
     252        params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly,
     253        getVerbosity()
    253254        );
    254255    if (AddJobsStatus)
  • src/Fragmentation/Automation/FragmentJobQueue.cpp

    rc099dc r6294b6  
    7575
    7676  // create job
    77   FragmentJob::ptr testJob( new MPQCJob(JobId::IllegalJob, output, begin, end, level) );
     77  const int verbose = getVerbosity();
     78  FragmentJob::ptr testJob( new MPQCJob(JobId::IllegalJob, output, begin, end, level, verbose) );
    7879  testJob->setPriority(newlines);
    7980  jobs.push_back(testJob);
  • src/Fragmentation/Automation/MPQCFragmentController.cpp

    rc099dc r6294b6  
    5454bool MPQCFragmentController::addJobsFromQueue(
    5555    const MPQCData::DoLongrange_t _DoLongrange,
    56     const MPQCData::DoValenceOnly_t _DoValenceOnly
     56    const MPQCData::DoValenceOnly_t _DoValenceOnly,
     57    const int _verbose
    5758    )
    5859{
     
    6667    job->DoLongrange = _DoLongrange;
    6768    job->DoValenceOnly = _DoValenceOnly;
     69    job->verbose = _verbose;
    6870    JobId_t id = getAvailableId();
    6971    if (id == (JobId_t)JobId::IllegalJob) {
  • src/Fragmentation/Automation/MPQCFragmentController.hpp

    rc099dc r6294b6  
    4747  bool addJobsFromQueue(
    4848      const MPQCData::DoLongrange_t _DoLongrange,
    49       const MPQCData::DoValenceOnly_t _DoValenceOnly
     49      const MPQCData::DoValenceOnly_t _DoValenceOnly,
     50      const int _verbose
    5051      );
    5152
  • src/Fragmentation/Exporters/ExportGraph_ToJobs.cpp

    rc099dc r6294b6  
    294294              JobId::IllegalJob,
    295295              output.str(),
    296               fragment_window.begin, fragment_window.end, fragment_window.level)
     296              fragment_window.begin, fragment_window.end, fragment_window.level, getVerbosity())
    297297#else
    298298          new MPQCCommandJob(output.str(), JobId::IllegalJob)
  • src/Jobs/MPQCJob.cpp

    rc099dc r6294b6  
    5555    const double _begin[NDIM],
    5656    const double _end[NDIM],
    57     const int _level) :
     57    const int _level,
     58    const int _verbose) :
    5859  FragmentJob(_JobId),
    5960  DoLongrange(MPQCData::DontSampleDensity),
    6061  DoValenceOnly(MPQCData::DoSampleValenceOnly),
    6162  inputfile(_inputfile),
    62   grid(_begin, _end, _level)
     63  grid(_begin, _end, _level),
     64  verbose(_verbose)
    6365{
    6466#ifndef NDEBUG
  • src/Jobs/MPQCJob.hpp

    rc099dc r6294b6  
    3939      const double _begin[NDIM],
    4040      const double _end[NDIM],
    41       const int _level);
     41      const int _level,
     42      const int _verbose);
    4243  virtual ~MPQCJob();
    4344
     
    4950  //!> whether to sample just the valence or the total electron and nuclei density
    5051  MPQCData::DoValenceOnly_t DoValenceOnly;
     52
     53  //!> verbosity level of mpqc: 0 will mute all std out
     54  int verbose;
    5155
    5256private:
     
    6973    ar & DoLongrange;
    7074    ar & DoValenceOnly;
     75    ar & verbose;
    7176    ar & const_cast<std::string &>(inputfile);
    7277    ar & const_cast<SamplingGridProperties &>(grid);
  • src/Jobs/MPQCJob_Work.cpp

    rc099dc r6294b6  
    7373  initvalues.in_char_array[nfilebase] = '\0';
    7474  initvalues.grp = MessageGrp::get_default_messagegrp();
     75  initvalues.verbose = verbose;
    7576  // create unique, temporary name and check whether it exists
    7677  char *tempfilename = NULL;
  • src/Jobs/MPQCJob_binding.hpp

    rc099dc r6294b6  
    2525    const double begin[3] = { 0., 0., 0. };
    2626    const double end[3] = { 1., 1., 1. };
    27     MPQCJob job(1, "test.in", begin, end, 2);
     27    MPQCJob job(1, "test.in", begin, end, 2, 0);
    2828  }
    2929}
Note: See TracChangeset for help on using the changeset viewer.