Platform and Device managing

-> ArrayFire Documentation

Selecting Platform

Fire.js platform can be selected by calling the root function with the appropriate platform ID as an argument.

Supported platform IDs:

Example:

var af = require("arrayfire-js");
var cpuPlatform = af("CPU");

getDeviceCount()

Gets the number of devices on the given platform.

Result: Number - number of devices

Example:

var af = require("arrayfire-js");
var cpuPlatform = af("CPU");
var deviceCount = cpuPlatform.getDeviceCount();

getDevices()

Gets available device descriptors on the given platform.

Result: Array - array of device descriptors

getDevice()

Get the current device ID.

Result: Number - current device ID

setDevice()

Change current device to specified device.

deviceInfo()

Get the current device's descriptor.

Result: object - fields

isDoubleAvailable()

Check if double precision support is available for specified device.

Argments:

Result: Booean - is double precision supported

sync()

asynchronous, counterparts: syncAsync, syncSync

Waits until all operations on device are finished.

wait()

alias of sync()

alloc()

Allocates memory on the device.

Arguments:

Result: Buffer - device memory pointer

Remarks: Deallocation is handled by the GC automatically

pinned()

Allocates pinned memory on the host by using ArrayFire's memory manager.

Arguments:

Result: Buffer - memory pointer

Remarks: Deallocation is handled by the GC automatically