profitOpenCLEnv: Create OpenCL Pointer Object

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/profitHPC.R

Description

This function returns a legal external pointer to a GPU card that will then be used to compute models.

Usage

1
profitOpenCLEnv(plat_idx = 1, dev_idx = 1, use_double = FALSE)

Arguments

plat_idx

The platform index to use for the GPU computation. If in doubt leave as the default (1).

dev_idx

The device index within the platform for the GPU computation. If in doubt leave as the default (1).

use_double

Logical; use double precision arithmetic. Double precision will re-create CPU calculations down to double precision accuracy. Single precision is not as accurate, but typically good to sub 1:1e6 relative error.

Details

Some computers might have multiple platforms and devices available for GPU computation. The indices used refer to device number N on platform number M. If you have multiple cards then you might have more than one card device on a single platform, or single devices across multiple platforms.

If your computer has a single card (or you do not know what platforms and devices means with regards to GPUs) you probably want to leave the values as their defaults.

Value

The output is an external pointer of class 'externalptr' to be parsed to profitMakeModel and/or profitSetupData. If there is any error building the OpenCL environment object an error is printed and NULL is returned.

Author(s)

Rodrigo Tobar & Aaron Robotham

See Also

profitOpenCLEnvInfo, profitClearCache, profitMakeModel, profitSetupData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
modellist = list(
  sersic = list(
    xcen   = c(180, 60),
    ycen   = c(90, 10),
    mag = c(15, 13),
    re  = c(14, 5),
    nser  = c(3, 10),
    ang  = c(46, 80),
    axrat  = c(0.4, 0.6),
    box = c(0.5,-0.5)
  ),
  pointsource = list(
    xcen   = c(34,10,150),
    ycen   = c(74,120,130),
    mag = c(10,13,16)
  ),
  sky = list(
    bg = 3e-12
  )
)

magimage(profitMakeModel(modellist=modellist, dim=c(200,200)))

## Not run: 
profitClearCache()
tempCL=profitOpenCLEnv()
magimage(profitMakeModel(modellist=modellist, dim=c(200,200), openclenv=tempCL))

## End(Not run)

ProFit documentation built on Nov. 11, 2019, 5:07 p.m.