Objective_function.gpu_objective_function module

Description

This module defines the ParaMol.Objective_function.cpu_objective_function.GPUObjectiveFunction class used by ParaMol to perform parallel evaluation of the objective function using CPUs.

class ParaMol.Objective_function.gpu_objective_function.GPUObjectiveFunction

Bases: object

ParaMol’s wrapper for the GPU parallel callback function.

Variables
  • X (list) – List containing conformations data.

  • calculate_energies (bool) – Flag that controls whether or not the energies will be calculated.

  • calculate_energies – Flag that controls whether or not the forces will be calculated.

  • n_atoms (int) – Number of atoms of the system-

Notes

Only usable with OpenMM’s ‘OpenCL’ platform.

f_callback_function(system, integrator, system_id, worker_id)

Method that may be used as a callback function for the parallel computation of the objective function using GPUs.

Parameters
  • system (ParaMol.Objective_function.pickable_swig.PickalableContext) – OpenMM system.

  • integrator (any OpenMM integrator object) – OpenMM integrator.

  • system_id (int) – Index of the OpenMM system copy.

  • worker_id (int) – Index of the parallel worker.

Notes

Unfortunately, for GPUs, context has to be created here, which slows down the computation as it is a costly operation. Only ‘OpenCL’ was tested. ‘CUDA’ platform hasn’t been tested yet.

Returns

emm_data, fmm_data (np.array(batch_size), np.array(batch_size, n_atoms, 3)) – Arrays containing MM energies and forces.

static init_worker()