package cuda
import "gvisor.dev/gvisor/test/gpu/cuda"
Package cuda holds libraries for testing CUDA workloads.
Index ¶
- func InitFlags()
- func RunCudaTests(ctx context.Context, t *testing.T, args *RunCudaTestArgs)
- type BrokenEverywhere
- func (*BrokenEverywhere) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
- func (be *BrokenEverywhere) WillFail(ctx context.Context, env *TestEnvironment) string
- type BrokenInGVisor
- func (*BrokenInGVisor) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
- func (big *BrokenInGVisor) WillFail(ctx context.Context, env *TestEnvironment) string
- type Compatibility
- func MultiCompatibility(compats ...Compatibility) Compatibility
- func RequiresFeatures(features ...Feature) Compatibility
- type Feature
- type FullyCompatible
- func (*FullyCompatible) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
- func (*FullyCompatible) WillFail(ctx context.Context, env *TestEnvironment) string
- type NoCrossCompile
- func (*NoCrossCompile) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, _ int) error
- func (*NoCrossCompile) WillFail(ctx context.Context, env *TestEnvironment) string
- type OnlyOnWindows
- func (*OnlyOnWindows) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
- func (*OnlyOnWindows) WillFail(ctx context.Context, env *TestEnvironment) string
- type RequiresMultiGPU
- func (*RequiresMultiGPU) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
- func (*RequiresMultiGPU) WillFail(ctx context.Context, env *TestEnvironment) string
- type RequiresNvSci
- func (*RequiresNvSci) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
- func (*RequiresNvSci) WillFail(ctx context.Context, env *TestEnvironment) string
- type RequiresP2P
- func (*RequiresP2P) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
- func (*RequiresP2P) WillFail(ctx context.Context, env *TestEnvironment) string
- type RunCudaTestArgs
- type TestEnvironment
Functions ¶
func InitFlags ¶
func InitFlags()
InitFlags parses the flags and sets the test.parallel flag to the desired parallelism.
func RunCudaTests ¶
func RunCudaTests(ctx context.Context, t *testing.T, args *RunCudaTestArgs)
RunCudaTests runs CUDA tests.
Types ¶
type BrokenEverywhere ¶
type BrokenEverywhere struct { Reason string }
BrokenEverywhere implements `Compatibility` for tests that are broken in all environments.
func (*BrokenEverywhere) IsExpectedFailure ¶
func (*BrokenEverywhere) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
IsExpectedFailure implements `Compatibility.IsExpectedFailure`.
func (*BrokenEverywhere) WillFail ¶
func (be *BrokenEverywhere) WillFail(ctx context.Context, env *TestEnvironment) string
WillFail implements `Compatibility.WillFail`.
type BrokenInGVisor ¶
type BrokenInGVisor struct { // OnlyWhenMultipleGPU may be set to true for tests which only fail when // multiple GPUs are present. This should not be used for tests that // *require* multiple GPUs to run (use RequiresMultiGPU instead). // This is for tests that can run on a single or multiple GPUs alike, // but specifically fail in gVisor when run with multiple GPUs. OnlyWhenMultipleGPU bool }
BrokenInGVisor implements `Compatibility` for tests that are broken in gVisor only.
func (*BrokenInGVisor) IsExpectedFailure ¶
func (*BrokenInGVisor) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
IsExpectedFailure implements `Compatibility.IsExpectedFailure`.
func (*BrokenInGVisor) WillFail ¶
func (big *BrokenInGVisor) WillFail(ctx context.Context, env *TestEnvironment) string
WillFail implements `Compatibility.WillFail`.
type Compatibility ¶
type Compatibility interface { // WillFail returns a string explaining why the test is expected to fail // in the given environment, or "" if it isn't expected to fail. WillFail(ctx context.Context, env *TestEnvironment) string // IsExpectedFailure checks whether the `logs` (from a failed run of the test // in the given environment) matches the failure that this test expects in // that environment. If they match, this function should return nil. // It is only called when `WillFail` returns a non-empty string for the same // environment, so it may assume that `env` is non-compatible. IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error }
Compatibility encodes the compatibility of a test depending on the environment it runs in.
func MultiCompatibility ¶
func MultiCompatibility(compats ...Compatibility) Compatibility
MultiCompatibility implements `Compatibility` with multiple possible Compatibility implementations.
func RequiresFeatures ¶
func RequiresFeatures(features ...Feature) Compatibility
RequiresFeatures implements `Compatibility` for tests that require specific features.
type Feature ¶
type Feature string
Feature is a feature as listed by /list_features.sh.
const ( FeaturePersistentL2Caching Feature = "PERSISTENT_L2_CACHING" FeatureDynamicParallelism Feature = "DYNAMIC_PARALLELISM" FeatureGL Feature = "GL" FeatureTensorCores Feature = "TENSOR_CORES" FeatureCompressibleMemory Feature = "COMPRESSIBLE_MEMORY" FeatureP2P Feature = "P2P" )
All CUDA features listed by /list_features.sh.
type FullyCompatible ¶
type FullyCompatible struct{}
FullyCompatible implements `Compatibility` for tests that are expected to pass in any environment.
func (*FullyCompatible) IsExpectedFailure ¶
func (*FullyCompatible) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
IsExpectedFailure implements `Compatibility.IsExpectedFailure`.
func (*FullyCompatible) WillFail ¶
func (*FullyCompatible) WillFail(ctx context.Context, env *TestEnvironment) string
WillFail implements `Compatibility.WillFail`.
type NoCrossCompile ¶
type NoCrossCompile struct{}
NoCrossCompile implements `Compatibility` for tests that cannot cross compile.
func (*NoCrossCompile) IsExpectedFailure ¶
func (*NoCrossCompile) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, _ int) error
IsExpectedFailure implements `Compatibility.IsExpectedFailure`.
func (*NoCrossCompile) WillFail ¶
func (*NoCrossCompile) WillFail(ctx context.Context, env *TestEnvironment) string
WillFail implements `Compatibility.WillFail`.
type OnlyOnWindows ¶
type OnlyOnWindows struct{}
OnlyOnWindows implements `Compatibility` for tests that are only expected to only pass on Windows.
func (*OnlyOnWindows) IsExpectedFailure ¶
func (*OnlyOnWindows) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
IsExpectedFailure implements `Compatibility.IsExpectedFailure`.
func (*OnlyOnWindows) WillFail ¶
func (*OnlyOnWindows) WillFail(ctx context.Context, env *TestEnvironment) string
WillFail implements `Compatibility.WillFail`.
type RequiresMultiGPU ¶
type RequiresMultiGPU struct{}
RequiresMultiGPU implements `Compatibility` for tests that require multiple GPUs.
func (*RequiresMultiGPU) IsExpectedFailure ¶
func (*RequiresMultiGPU) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
IsExpectedFailure implements `Compatibility.IsExpectedFailure`.
func (*RequiresMultiGPU) WillFail ¶
func (*RequiresMultiGPU) WillFail(ctx context.Context, env *TestEnvironment) string
WillFail implements `Compatibility.WillFail`.
type RequiresNvSci ¶
type RequiresNvSci struct{}
RequiresNvSci implements `Compatibility` for tests that require the NvSci library.
func (*RequiresNvSci) IsExpectedFailure ¶
func (*RequiresNvSci) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
IsExpectedFailure implements `Compatibility.IsExpectedFailure`.
func (*RequiresNvSci) WillFail ¶
func (*RequiresNvSci) WillFail(ctx context.Context, env *TestEnvironment) string
WillFail implements `Compatibility.WillFail`.
type RequiresP2P ¶
type RequiresP2P struct{}
RequiresP2P implements `Compatibility` for tests that require peer-to-peer communication between GPUs. Implies RequiresMultiGPU, so tests do not need to specify both.
func (*RequiresP2P) IsExpectedFailure ¶
func (*RequiresP2P) IsExpectedFailure(ctx context.Context, env *TestEnvironment, logs string, exitCode int) error
IsExpectedFailure implements `Compatibility.IsExpectedFailure`.
func (*RequiresP2P) WillFail ¶
func (*RequiresP2P) WillFail(ctx context.Context, env *TestEnvironment) string
WillFail implements `Compatibility.WillFail`.
type RunCudaTestArgs ¶
type RunCudaTestArgs struct { // TestSuiteCompatibility maps test suites to their compatibility data. // Unmapped test suites are assumed to be fully compatible. TestSuiteCompatibility map[string]Compatibility // SkippedTestSuites maps test suites to a skip reason. // If a test suite is mapped, then all tests in that suite will be skipped. SkippedTestSuites map[string]string // TestCompatibility maps test names to their compatibility data. // Unmapped test names are assumed to be fully compatible. TestCompatibility map[string]Compatibility // FlakyTests is a list of tests that are flaky. // These will be retried up to 3 times in parallel before running 3 times // serially. FlakyTests map[string]struct{} // ExclusiveTests is a list of tests that must run exclusively (i.e. with // no other test running on the machine at the same time), or they will // likely fail. These tests are not attempted to be run in parallel. // This is usually the case for performance tests or tests that use a lot // of resources in general. // This saves the trouble to run them in parallel, while also avoiding // causing spurious failures for the tests that happen to be running in // parallel with them. ExclusiveTests map[string]struct{} // AlwaysSkippedTests don't run at all, ever, and are not verified when // --cuda_verify_compatibility is set. // Each test is mapped to a reason why it should be skipped. AlwaysSkippedTests map[string]string // Image is the image to use for the CUDA tests. Image string }
RunCudaTestArgs contains arguments for RunCudaTests.
type TestEnvironment ¶
TestEnvironment represents the environment in which a sample test runs.
func GetEnvironment ¶
GetEnvironment returns the environment in which a sample test runs.
Source Files ¶
cuda.go
- Version
- v0.0.0-20250702182429-85e76111eb28 (latest)
- Published
- Jul 2, 2025
- Platform
- linux/amd64
- Imports
- 16 packages
- Last checked
- 3 hours ago –
Tools for package owners.