-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of generated rotation matrix sets in parallel with the '…
…rotate' command (#1112) * Fix accessing the internal rotation matrix data set in parallel for 'rotate' * Class to choose correct frame number in parallel based on whether a data set exists or is being generated * Use ParallelSetFrameNum * Hide debug info * 6.29.6. Revision bump for fixed handling of input rotation matrix data set in rotate command.
- Loading branch information
Showing
7 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "ParallelSetFrameNum.h" | ||
#include "CpptrajStdio.h" | ||
#include "DataSet.h" | ||
using namespace Cpptraj; | ||
|
||
void ParallelSetFrameNum::SetForParallel(DataSet const* setIn) { | ||
set_ = setIn; | ||
# ifdef MPI | ||
// In parallel, number to use will depend on whether the set exists or not | ||
if (set_->Size() > 0) | ||
exists_ = true; | ||
else | ||
exists_ = false; | ||
# ifdef DEBUG_CPPTRAJ_PARALLELSETFRAMENUM | ||
if (!exists_) | ||
rprintf("DEBUG: Set '%s' does not yet exist.\n", set_->legend()); | ||
else | ||
rprintf("DEBUG: Set '%s' exists with size %zu.\n", set_->legend(), set_->Size()); | ||
# endif | ||
# endif /*MPI */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef INC_PARALLELSETFRAMENUM_H | ||
#define INC_PARALLELSETFRAMENUM_H | ||
class DataSet; | ||
namespace Cpptraj { | ||
/// Used to pick the correct frame from a data set in parallel | ||
/** In parallel, Actions that access data from DataSets need to handle | ||
* two cases: | ||
* 1) The data set exists already before trajectory processing. | ||
* 2) The data set is being created during trajectory processing. | ||
* In case 1, the data set should be accessed using ActionFrame::TrajoutNum(). | ||
* In case 2, the data set should be accessed using the frameNum variable | ||
* since the set has not yet been synced. | ||
*/ | ||
class ParallelSetFrameNum { | ||
public: | ||
/// CONSTRUCTOR | ||
ParallelSetFrameNum() : set_(0), exists_(false) {} | ||
/// Initialize with DataSet, record if it has any data yet. | ||
void SetForParallel(DataSet const*); | ||
/// \return Correct frame number in parallel based on whether set exists or is being generated | ||
int ParallelFrameNum(int frameNum, int trajoutNum) const { | ||
# ifdef MPI | ||
// In parallel, number to use depends on whether the set is being generated or not. | ||
if (exists_) | ||
return trajoutNum; | ||
else | ||
return frameNum; | ||
# else | ||
// In serial, just return the frame number. | ||
return frameNum; | ||
# endif | ||
} | ||
private: | ||
DataSet const* set_; ///< The DataSet in question | ||
bool exists_; ///< True if set exists, false if it is being generated. | ||
}; | ||
} // END namespace Cpptraj | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters