Skip to content

Commit

Permalink
add: read configuration from config.toml (#2015)
Browse files Browse the repository at this point in the history
  • Loading branch information
inureyes authored Nov 7, 2023
1 parent b8ef3a5 commit 890bcfe
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
5 changes: 5 additions & 0 deletions config.toml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ maxCPUCoresPerContainer = 256 # Maximum CPU per container.
maxMemoryPerContainer = 64 # Maximum memory per container.
maxCUDADevicesPerContainer = 8 # Maximum CUDA devices per container.
maxCUDASharesPerContainer = 8 # Maximum CUDA shares per container.
maxROCMDevicesPerContainer = 10 # Maximum ROCm devices per container.
maxTPUDevicesPerContainer = 8 # Maximum TPU devices per container.
maxIPUDevicesPerContainer = 8 # Maximum IPU devices per container.
maxATOMDevicesPerContainer = 8 # Maximum ATOM devices per container.
maxWarboyDevicesPerContainer = 8 # Maximum Warboy devices per container.
maxShmPerContainer = 16 # Maximum shared memory per container.
maxFileUploadSize = 4294967296 # Maximum size of single file upload. Set to -1 for unlimited upload.

Expand Down
57 changes: 56 additions & 1 deletion src/components/backend-ai-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ export default class BackendAILogin extends BackendAIPage {
@property({ type: Boolean }) maxMemoryPerContainer = 16;
@property({ type: Number }) maxCUDADevicesPerContainer = 16;
@property({ type: Number }) maxCUDASharesPerContainer = 16;
@property({ type: Number }) maxROCMDevicesPerContainer = 10;
@property({ type: Number }) maxTPUDevicesPerContainer = 8;
@property({ type: Number }) maxIPUDevicesPerContainer = 8;
@property({ type: Number }) maxATOMDevicesPerContainer = 8;
@property({ type: Number }) maxWarboyDevicesPerContainer = 8;
@property({ type: Boolean }) maxShmPerContainer = 2;
@property({ type: Boolean }) maxFileUploadSize = -1;
@property({ type: Boolean }) maskUserInfo = false;
Expand Down Expand Up @@ -914,7 +919,57 @@ export default class BackendAILogin extends BackendAIPage {
} as ConfigValueObject,
) as number;

// Max CUDA shares per container number
// Max ROCm devices per container number
this.maxROCMDevicesPerContainer = this._getConfigValueByExists(
resourcesConfig,
{
valueType: 'number',
defaultValue: 10,
value: parseInt(resourcesConfig?.maxROCMDevicesPerContainer),
} as ConfigValueObject,
) as number;

// Max TPU devices per container number
this.maxTPUDevicesPerContainer = this._getConfigValueByExists(
resourcesConfig,
{
valueType: 'number',
defaultValue: 8,
value: parseInt(resourcesConfig?.maxTPUDevicesPerContainer),
} as ConfigValueObject,
) as number;

// Max IPU devices per container number
this.maxIPUDevicesPerContainer = this._getConfigValueByExists(
resourcesConfig,
{
valueType: 'number',
defaultValue: 8,
value: parseInt(resourcesConfig?.maxIPUDevicesPerContainer),
} as ConfigValueObject,
) as number;

// Max ATOM devices per container number
this.maxATOMDevicesPerContainer = this._getConfigValueByExists(
resourcesConfig,
{
valueType: 'number',
defaultValue: 8,
value: parseInt(resourcesConfig?.maxATOMDevicesPerContainer),
} as ConfigValueObject,
) as number;

// Max Warboy devices per container number
this.maxWarboyDevicesPerContainer = this._getConfigValueByExists(
resourcesConfig,
{
valueType: 'number',
defaultValue: 8,
value: parseInt(resourcesConfig?.maxWarboyDevicesPerContainer),
} as ConfigValueObject,
) as number;

// Max shared memory per container number
this.maxShmPerContainer = this._getConfigValueByExists(resourcesConfig, {
valueType: 'number',
defaultValue: 2,
Expand Down

0 comments on commit 890bcfe

Please sign in to comment.