Hi everyone, I just realised about something relat...
# ask-the-community
j
Hi everyone, I just realised about something related to pyflyte and python environments 🤔 . I am not sure if I have done something but I can't get pyflyte to work on the specific virtual environment activated? pyflyte runs the code on the global environment instead. I have created a quick example of a pipeline that requires torch and I have a brand new environment but the pipeline runs successfully with my global dependencies. Anyone have managed to separate environments correctly? Thanks!
e
Can you remove flytekit from the global environment and install it in this
test
venv you created? Also, how does
gpu_pipeline.py
look like?
j
Thanks @Eduardo Apolinario (eapolinario) it does work that way 👍
Workflow was just an example for my colleagues on how to use GPU and to show them the difference between running it locally vs remote
Copy code
# Task requires 1 GPU as well as some cpu and memory
@task(
    container_image=custom_image,
    requests=Resources(cpu="1", mem="1Gi", gpu="1"),
    limits=Resources(cpu="1", mem="1Gi", gpu="1"),
)
def run_gpu_task():
    cuda_available = torch.cuda.is_available()
    print("DS Ops demo!!!!!")
    print(f"Is cuda available? {cuda_available}")
    if cuda_available:
        print("__CUDNN VERSION:", torch.backends.cudnn.version())
        print("__Number CUDA Devices:", torch.cuda.device_count())
        print("__CUDA Device Name:", torch.cuda.get_device_name(0))
        print(
            "__CUDA Device Total Memory [GB]:",
            torch.cuda.get_device_properties(0).total_memory / 1e9,
        )

    return


@workflow
def gpu_example():
    run_gpu_task()