EMR Serverless queue supports mGPU, enabling resource sharing on a single GPU card, flexible allocation of compute cores and GPU memory resources, and strict isolation. This article introduces how to enable and use mGPU resources.
tip
For detailed information about mGPU, refer to: mGPU Overview.
On the EMR Serverless Create queue interface, after selecting GPU Resource allocation, you can choose to enable mGPU. Once created queue, mGPU resources will be used.
tip
See the table below for mGPU-related parameters. For detailed GPU parameters, refer to EMR Serverless GPU parameter description.
Job types | Parameter key | Parameter meaning | Parameter example |
|---|---|---|---|
CustomJob | emr.serverless.mgpu.core | Set the computing power used by a single Pod. warning When the value is set to 100 or greater, it indicates the use of the full computing power of a GPU card. Only integer multiples of 100 can be set. For example, 200 indicates that two full GPU cards are mounted. | 30 |
emr.serverless.mgpu.memory | Set the video memory used by a single Pod. The unit is MiB. For example, 4096 means GPU video memory of 4 GiB. warning When Mgpu Core is set to 100 or greater, full card resources are used by default. After this parameter is set, the mgpu memory parameter cannot be set. | 4096 | |
serverless.custom.job.task.gpus | The number of GPU cards per CustomJob Task. In the mGPU scenario, the quantity is automatically converted to the use of full GPU cards. For example, 2 means using 2 full GPU cards. warning The priority of emr.serverless.mgpu.core is higher than that of serverless.custom.job.task.gpus. | 1 | |
Ray | serverless.ray.head.mgpu.core | Ray Head dedicated configuration. Set the mgpu core used by ray head separately. Usage aligns with | 30 |
serverless.ray.head.mgpu.memory | Ray Head dedicated configuration. Set the mgpu memory used by ray head. Usage aligns with emr.serverless.mgpu.memory. | 4096 | |
serverless.ray.worker.mgpu.core | Ray Worker dedicated configuration. Set the mgpu core used by ray worker separately. Usage aligns with | 30 | |
serverless.ray.worker.mgpu.memory | Ray Worker dedicated configuration. Set the mgpu memory used by ray worker. Usage aligns with | 4096 | |
serverless.ray.worker.gpu.amount | The number of GPU cards per Ray Worker. In the mgpu scenario, the quantity is automatically converted to the use of full GPU cards. For example, 2 means using 2 full GPU cards. warning The priority of serverless.ray.worker.mgpu.core is higher than that of serverless.ray.worker.gpu.amount. | 1 |
warning
From the engine's perspective, it still sees a complete GPU card, but the memory and computing power of this "card" are restricted. Therefore, the upper-layer engine business code can still treat it as a single card.
In the default compute group, you can additionally set the following parameters:
-- Set mgu-related parameters emr.serverless.mgpu.core=30; emr.serverless.mgpu.memory=1000; -- Set historical GPU parameters. When the mgpu queue is enabled, full GPU cards are used by default. -- Equivalent to emr.serverless.mgpu.core=100 serverless.custom.job.task.gpus=1;
After setting, each CustomJob Task will mount a GPU card and use only 30% of its compute power and 1000 MiB of GPU memory.
In the default compute group, you can additionally set the following parameters:
-- mgpu-related parameters serverless.ray.worker.mgpu.core=30; serverless.ray.worker.mgpu.memory=4096; -- Set historical GPU parameters. When the mgpu queue is enabled, full GPU cards are used by default. -- Equivalent to serverless.ray.worker.mgpu.core; serverless.ray.worker.gpu.amount=1;
After setting, each Ray Worker will mount a GPU card, but each Worker will only use 30% of the GPU card's compute power and 4096 MiB of GPU memory. You can also see that each Worker has one GPU card resource in the Ray dashboard:
In Ray Cluster/Ray Serve, you can set the required mGPU core and GPU memory for Worker/Head through the interface.
When the setting is greater than or equal to 100, it indicates the use of the full card's computing power. Only integer multiples of 100 can be set. For example, 200 means using the computing power of two full GPU cards.
In EMR Console > Queue Details > Queue Monitoring > GPU Resources , you can view the current queue's mGPU Core and Memory usage.
If the job fails to start after setting mGPU parameters, check whether the values of mGPU core and mGPU memory meet the requirements: