Loading TOC...


   $config as element(configuration),
   $group-id as (Number|String),
   $value as Number
) as element(configuration)


This function sets the GPU to be used as the default computation device by CNTK, when group:cntk-default-device is set to gpu.

Changing GPU ID restarts MarkLogic server.

$config A configuration specification, typically as returned from one of the Admin module functions.
$group-id The ID of the group. Typically, this is the result of an admin:group-get-id call.
$value The CUDA ID of the GPU to be used as the default computation device.

Required Privileges

This operation requires at least one of the following privileges:



Usage Notes

To find out the CUDA device ID of your GPU, please consult NVIDIA CUDA documentation. Generally, CUDA device ID starts from 0, with 0 being the most "powerful" GPU on your machine. When set to an invalid ID (for example, set to 5 when there are only 2 GPUs on the machine), during server start up, an error message will be logged at info level, and the effective GPU ID will default to 0, even though on admin GUI or through admin:group-get-cntk-gpu-id, the invalid GPU ID is still seen.


  xquery version "1.0-ml";

  import module namespace admin = "http://marklogic.com/xdmp/admin"
      at "/MarkLogic/admin.xqy";

  let $config := admin:get-configuration()
  let $groupid := admin:group-get-id($config, "Default")
  let $value := 0
  return admin:group-set-cntk-gpu-id($config, $groupid, $value)

  (: returns the new configuration element -- use admin:save-configuration
     to save the changes to the configuration or pass the configuration
     to other Admin API functions to make other changes.  :)

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.