mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fee688bd051a5bde4e2e8a4d5e0f5d75c7ffe00a
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e14221fe62 |
feat(sagemaker): support GPU-backed training jobs (#4015)
* feat(sagemaker): support GPU-backed training jobs ResourceConfig.InstanceType had no effect on the container Floci launched, so a training job asking for ml.g5.xlarge ran on CPU. This maps the accelerator half of an instance type onto a real device request, using the container GPU primitive added in #3789. On AWS the instance type *is* the hardware, so nothing is configurable. Floci has one host with fixed cards, so serving a GPU instance type means substituting a local device, and which devices may be lent out is a local decision. The two halves are split accordingly: - How many accelerators an ml.* type carries is a property of AWS, so it ships as data in sagemaker/instance-type-catalog.yaml, mirroring how Ec2InstanceTypeCatalog already carries vcpu and memory for EC2 types. It is kept separate from that catalog because ml.* is its own namespace and must never appear in DescribeInstanceTypes. - Which of this machine's devices may be used is configuration, under floci.services.sagemaker.gpu: enabled, mode and devices. Nothing changes unless enabled is set. It defaults to false, so existing deployments keep launching CPU-only containers, including for GPU instance types. mode exists because daemons disagree on the wire form. It defaults to cdi: Podman resolves only CDI and accepts a count request while attaching no device (containers/podman#22645), so preferring CDI turns a misconfiguration into a refused start rather than a job that quietly trains on CPU. That principle drives the failure cases too: an unlisted GPU-family type, too few allowed devices, an explicit mode with no devices, and InstanceCount above one all fail with a FailureReason instead of falling back to CPU. A job that reports Completed after training on the wrong hardware leaves an artifact that looks legitimate, which is worse than an error. Only the accelerator is substituted. An instance type also implies vCPU and memory, which this does not emulate, consistent with the rest of the codebase: EC2 instance types are metadata for DescribeInstanceTypes and never size a container, RDS records DBInstanceClass without acting on it, and Lambda, ECS and Batch apply limits only where an API supplies an explicit number. Endpoint hosting is unchanged and still CPU-only; the resolver is a separate bean so it can be reused there in a follow-up. * test(sagemaker): cover the GPU refusal paths and the hardware path The GPU feature shipped with unit coverage on the resolver only, so nothing exercised it through CreateTrainingJob. These add both halves. SageMakerGpuIntegrationTest runs everywhere. Every path that refuses a request raises inside SageMakerGpuResolver, before the runner asks the daemon for anything, and the removeIfExists above it already swallows a missing daemon, so an unlisted GPU family, InstanceCount above one, and cdi mode with no configured devices all reach their verdict on a plain runner. A fourth case pins the contract that enabling the feature leaves CPU instance types alone. SageMakerGpuDockerIntegrationTest is opt-in behind -Dgpu.integration.enabled, matching ContainerGpuDockerIntegrationTest, because it needs hardware no CI runner has. Verified against an RTX 5060 Ti through Podman 5.8.2: the container saw exactly the device named in gpu.devices and not the host's other card. The assertion is the container's exit code. nvidia-smi output is redirected rather than piped: a pipeline exits with the status of its last command, so 'nvidia-smi -L | tee' reports success even when nvidia-smi cannot reach the driver, which would be this test passing on a CPU container. * fix(sagemaker): package the instance type catalog in the native image SageMakerInstanceTypeCatalog reads sagemaker/instance-type-catalog.yaml through a constant, which Quarkus's static resource analysis cannot follow, and no glob under quarkus.native.resources.includes matched it. The file was therefore left out of the native image, so enabling floci.services.sagemaker.gpu.enabled there would have failed every training job at catalog load with 'Missing catalog resource sagemaker/instance-type-catalog.yaml'. Ec2InstanceTypeCatalog reads its own catalog the same way and ec2/*.yaml was already listed for exactly this reason. Nothing caught it: JVM tests resolve the file from src/main/resources, and the hardware verification ran a JVM-mode image, so the gap existed only in the artifact neither exercised. NativeImageResourceIncludesTest closes that gap the way NativeImageRuntimeInitializationTest closes the Random-in-the-image-heap one, by moving a native-only failure into ordinary CI. It pairs each resource-path constant passed to getResourceAsStream with the includes globs and fails when none matches, skipping the IAM catalog that application.yml already documents as build-time only. * refactor(sagemaker): match EC2's case handling for instance types isAcceleratorFamily folded case while gpuCount did not, so ML.G5.XLARGE was answered as a GPU family and then reported as missing from the catalog, pointing the caller at the wrong fix. Ec2InstanceTypeCatalog is the precedent and normalizes in neither position: find() looks the type up exactly and familyOf() splits on the first dot without folding. AWS instance types are exact tokens. The repo folds case where AWS defines a value as case-insensitive, such as ACM domain names, regions and content types, which an instance type is not. Dropping the fold rather than adding one to gpuCount keeps both halves agreeing and keeps the pair behaving like EC2's. Also drops the @DisplayName from SageMakerGpuResolverTest. The suite does not use them anywhere else; the method name carries the intent. * docs(sagemaker): clarify GPU training device reuse |
||
|
|
e2aefa654b |
feat(sagemaker): add SageMaker emulation with Docker-backed training (#1949)
Implement the SageMaker control plane over the AWS JSON 1.1 protocol
(X-Amz-Target: SageMaker.*) plus the runtime invocation path:
- Models, endpoint configs, endpoints, training jobs, and tags with
AWS-shaped validation errors (ValidationException / ResourceInUse)
- CreateTrainingJob runs the training image as a real Docker container
using the /opt/ml contract: hyperparameters, resourceconfig and
inputdataconfig under /opt/ml/input/config, S3 channel data under
/opt/ml/input/data/<channel>, and /opt/ml/model uploaded back to S3
as model.tar.gz under the configured S3OutputPath
- CreateEndpoint hosts the model image as a long-lived container with
the serve command, /ping health checks, and ModelDataUrl artifacts
extracted into /opt/ml/model
- POST /endpoints/{name}/invocations proxies to the container and maps
model 5xx responses to ModelError (HTTP 424) like SageMaker Runtime
- Training container logs stream to CloudWatch Logs under
/aws/sagemaker/TrainingJobs
- Storage wired through StorageFactory with memory/persistent modes,
config in EmulatorConfig and both application.yml files
- Unit, integration, and Docker-gated integration tests plus a boto3
compatibility test; service and docs registered in the catalog
|