Mesos does not yet provide direct support for the GPU, but supports special types of resources. If you specify --resources="gpu(*):8" when running mesos-slave, this will become part of the resource offer for frameworks, which can run tasks that claim to use these resources. When some of the gpu resources are used in the task, only the remaining resources will be offered again until this task completes, and the gpu resources will appear again. In this way, the Mesos Resource Distributor can actually plan the gpu resources you have announced and ensure that only the declared amounts are offered / allocated to the frameworks.
Mesos does not yet support gpu isolation, but with "plugin isolation modules" you can create your own isolated gpu to provide gpu resource limits.
Alternatively, if you do not want to allocate separate gpu resources, but only want to declare some nodes as having gpus and others not, you can simply use --attributes="hasGpu:true" or something similar to distinguish between nodes that do / do not have gpus. This information is also passed into the framework in the resource offers, but these attributes cannot be "consumed" by the task being performed, therefore they will always be offered for this node.
For more information see https://mesos.apache.org/documentation/attributes-resources/
source share