code: def _initialize_likelihood_prior(self, positions, log_likelihoods, log_priors):
          
          func = SimpleCLFunction.from_string('''
              void compute(global mot_float_type* chain_position,
                           global mot_float_type* log_likelihood,
                           global mot_float_type* log_prior,
                           local mot_float_type* x_tmp,
                           void* data){
                  
                  bool is_first_work_item = get_local_id(0) == 0;
      
                  if(is_first_work_item){
                      for(uint i = 0; i < ''' + str(self._nmr_params) + '''; i++){
                          x_tmp[i] = chain_position[i];
                      }
                      *log_prior = _computeLogPrior(x_tmp, data);
                  }
                  barrier(CLK_LOCAL_MEM_FENCE);
                      
                  *log_likelihood = _computeLogLikelihood(x_tmp, data);
              }
          ''', dependencies=[self._get_log_prior_cl_func(), self._get_log_likelihood_cl_func()])
  
          kernel_data = {
              'chain_position': Array(positions, 'mot_float_type', mode='rw', ensure_zero_copy=True),
              'log_likelihood': Array(log_likelihoods, 'mot_float_type', mode='rw', ensure_zero_copy=True),
              'log_prior': Array(log_priors, 'mot_float_type', mode='rw', ensure_zero_copy=True),
              'x_tmp': LocalMemory('mot_float_type', self._nmr_params),
              'data': self._data
          }
  
          func.evaluate(kernel_data, self._nmr_problems,
                        use_local_reduction=all(env.is_gpu for env in self._cl_runtime_info.cl_environments),
                        cl_runtime_info=self._cl_runtime_info)
docs: Initialize the likelihood and the prior using the given positions.
  
          This is a general method for computing the log likelihoods and log priors for given positions.
  
          Subclasses can use this to instantiate secondary chains as well.