Context

class Context

A context describes the device type and id on which computation should be carried on.

cpu(dev_id=0)
Parameters:dev_id (Int) – the CPU id.

Get a CPU context with a specific id. cpu() is usually the default context for many operations when no context is specified.

gpu(dev_id=0)
Parameters:dev_id (Int) – the GPU device id.

Get a GPU context with a specific id. The K GPUs on a node is typically numbered as 0,…,K-1.