Skip to content

Commit

Permalink
If we ingnore the viria, it looks like we are here
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed Feb 21, 2025
1 parent ab63e35 commit 8f15f0d
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/core/ParallelTaskManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void ParallelTaskManager<T, D>::applyForces( std::vector<double>& forcesForApply
}
}

if( useacc &&false ) {
if( useacc ) {
#ifdef __PLUMED_HAS_OPENACC
omp_forces[0].assign( omp_forces[0].size(), 0.0 );
auto value_stash_data = value_stash.data();
Expand All @@ -405,8 +405,14 @@ void ParallelTaskManager<T, D>::applyForces( std::vector<double>& forcesForApply
const auto ndev_per_task = nderivatives_per_task;
const auto ncomponents = myinput.ncomponents;

// std::vector<double> derivatives( nderivs );
double * derivatives = nullptr;// derivatives.data();
//To future me/you:
// I need to allocate this on the host to create a bigger temporay data array
// on the device
// by trying with double* x=nullptr, you will get a failure
// antother solution is acc_malloc and then device_ptr in the pragma
// (but you have to remember the acc_free)
std::vector<double> derivative(0);
double * derivatives = derivative.data();

ParallelActionsInput input = myinput;
auto myinput_acc = fromToDataHelper(input);
Expand All @@ -429,16 +435,17 @@ void ParallelTaskManager<T, D>::applyForces( std::vector<double>& forcesForApply
std::vector<double> fake_valstmp( input.ncomponents );
std::size_t task_number = partialTaskList_data[i];
std::size_t val_pos = task_number*input.ncomponents;
ParallelActionsOutput myout( input.ncomponents, fake_valstmp.data(), nderivs,derivatives );
// std::vector<double> derivative( nderivs );
ParallelActionsOutput myout( input.ncomponents, fake_valstmp.data(), nderivs,derivatives);
// Calculate the stuff in the loop for this action
T::performTask( task_number, t_actiondata, input, myout );

// Gather the forces from the values
// T::gatherForces<false>( task_number, t_actiondata, input,
// ForceInput( input.ncomponents,
// value_stash_data+input.ncomponents*task_number,
// ndev_per_task, derivatives),
// ForceOutput { omp_forces_data,of_size, forcesForApply_data,ffa_size } );
T::gatherForces<false>( task_number, t_actiondata, input,
ForceInput( input.ncomponents,
value_stash_data+input.ncomponents*task_number,
ndev_per_task, derivatives),
ForceOutput { omp_forces_data,of_size, forcesForApply_data,ffa_size } );

}
// #pragma acc parallel loop
Expand Down

0 comments on commit 8f15f0d

Please sign in to comment.