gpu
This module has been generated via dagger init and serves as a reference tobasic module structure as you get started with Dagger.
Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.
The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.
Installation
dagger install github.com/samalba/dagger-modules/nvidia-gpu@be3899f673fbdedb8549ddab7212f66cd4bc6c97
Entrypoint
Return Type
Gpu
Example
dagger -m github.com/samalba/dagger-modules/nvidia-gpu@be3899f673fbdedb8549ddab7212f66cd4bc6c97 call \
func (m *myModule) example() *Gpu {
return dag.
Gpu()
}
@function
def example() -> dag.Gpu:
return (
dag.gpu()
)
@func()
example(): Gpu {
return dag
.gpu()
}
Types
Gpu 🔗
deployDaggerOnFly() 🔗
Returns lines that match a pattern in the files of the provided Directory Once deployed, in order to point to the new remote engine: export _EXPERIMENTAL_DAGGER_RUNNER_HOST=tcp://.internal:2345
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
token | Secret ! | - | No description provided |
org | String ! | - | No description provided |
Example
dagger -m github.com/samalba/dagger-modules/nvidia-gpu@be3899f673fbdedb8549ddab7212f66cd4bc6c97 call \
deploy-dagger-on-fly --token env:MYSECRET --org string
func (m *myModule) example(ctx context.Context, token *Secret, org string) string {
return dag.
Gpu().
DeployDaggerOnFly(ctx, token, org)
}
@function
async def example(token: dagger.Secret, org: str) -> str:
return await (
dag.gpu()
.deploy_dagger_on_fly(token, org)
)
@func()
async example(token: Secret, org: string): Promise<string> {
return dag
.gpu()
.deployDaggerOnFly(token, org)
}
testCuda() 🔗
TestCuda tests if it can access the GPU, returns GPU information
Return Type
String !
Example
dagger -m github.com/samalba/dagger-modules/nvidia-gpu@be3899f673fbdedb8549ddab7212f66cd4bc6c97 call \
test-cuda
func (m *myModule) example(ctx context.Context) string {
return dag.
Gpu().
TestCuda(ctx)
}
@function
async def example() -> str:
return await (
dag.gpu()
.test_cuda()
)
@func()
async example(): Promise<string> {
return dag
.gpu()
.testCuda()
}
hasGpu() 🔗
Return Type
Boolean !
Example
dagger -m github.com/samalba/dagger-modules/nvidia-gpu@be3899f673fbdedb8549ddab7212f66cd4bc6c97 call \
has-gpu
func (m *myModule) example(ctx context.Context) bool {
return dag.
Gpu().
HasGpu(ctx)
}
@function
async def example() -> bool:
return await (
dag.gpu()
.has_gpu()
)
@func()
async example(): Promise<boolean> {
return dag
.gpu()
.hasGpu()
}
ollamaRun() 🔗
OllamaRun spins up an Ollama server and run a prompt
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
model | String | "llama3.2" | Model to pull and use for the prompt |
prompt | String | "What color is the grass?" | Prompt to use on the model |
Example
dagger -m github.com/samalba/dagger-modules/nvidia-gpu@be3899f673fbdedb8549ddab7212f66cd4bc6c97 call \
ollama-run
func (m *myModule) example(ctx context.Context) string {
return dag.
Gpu().
OllamaRun(ctx)
}
@function
async def example() -> str:
return await (
dag.gpu()
.ollama_run()
)
@func()
async example(): Promise<string> {
return dag
.gpu()
.ollamaRun()
}
destroyDaggerOnFly() 🔗
Destroy the remote Flyio app
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
token | Secret ! | - | No description provided |
app | String ! | - | No description provided |
Example
dagger -m github.com/samalba/dagger-modules/nvidia-gpu@be3899f673fbdedb8549ddab7212f66cd4bc6c97 call \
destroy-dagger-on-fly --token env:MYSECRET --app string
func (m *myModule) example(ctx context.Context, token *Secret, app string) string {
return dag.
Gpu().
DestroyDaggerOnFly(ctx, token, app)
}
@function
async def example(token: dagger.Secret, app: str) -> str:
return await (
dag.gpu()
.destroy_dagger_on_fly(token, app)
)
@func()
async example(token: Secret, app: string): Promise<string> {
return dag
.gpu()
.destroyDaggerOnFly(token, app)
}