class Context

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

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.

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.