Learn R Programming

bayesCL (version 0.0.1)

prepare: GPU preparation for PolyaGamma sampling and/or Bayesian Inference

Description

Generates the external pointer to the GPU. This function compiles the OpenCL code, creates the command queue, etc. It can be used in order to avoid compilation/creation in each call of the rpg, mlr, and lasso.

Usage

prepare(precision=0,device=-1, parameters=NULL )

Arguments

precision
the number of random variates to simulate.
device
the ID of the device for which to generate the helper variables.
parameters
a 9 dimensional vector of parameters to tune the GPU implementation.

Value

This function returns an external pointer to a C structure for the GPU.

Details

This is used in order to avoid unnecesarry recompilation of OpenCL kernel and creation of contexts, command queues, etc.. The output of this function is a pointer that can be passed to the mlr, lasso and rpg functions. If the pointer is not passed to these functions, the prepare function is called from inside the mlr/lasso/rpg functions in each call. If no device number is specified, a list of devices with their respective IDs will be shown and you will be prompted to enter a number. In order to tune the implementation you can specify your own values for implementation parameters, which is a 9 dimensional vector.

See Also

rpg,lasso,mlr

Examples

Run this code
  gpu_pointer <- prepare(precision=0, device=0)

Run the code above in your browser using DataLab