Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| software:tensorflow:caviness [2026-04-02 15:17] – [GPU support] Complete section mbotto | software:tensorflow:caviness [2026-04-02 15:33] (current) – [CPU only] Complete section mbotto | ||
|---|---|---|---|
| Line 177: | Line 177: | ||
| ==== CPU only ==== | ==== CPU only ==== | ||
| + | The '' | ||
| + | |||
| + | <code bash> | ||
| + | [(my_workgroup: | ||
| + | Loading channels: done | ||
| + | # Name | ||
| + | tensorflow | ||
| + | tensorflow | ||
| + | : | ||
| + | tensorflow | ||
| + | tensorflow | ||
| + | tensorflow | ||
| + | tensorflow | ||
| + | tensorflow | ||
| + | tensorflow | ||
| + | : | ||
| + | </ | ||
| + | |||
| + | Note that the build tag provides the distinction between variants built on top of specific devices or libraries. For example, the third '' | ||
| + | |||
| + | All versions of the TensorFlow virtualenv will be stored in the common base directory, '' | ||
| + | |||
| + | <code bash> | ||
| + | [(my_workgroup: | ||
| + | 2.19.1-cpu | ||
| + | </ | ||
| + | |||
| + | The virtualenv is created using the '' | ||
| + | |||
| + | <code bash> | ||
| + | [(my_workgroup: | ||
| + | : | ||
| + | Preparing transaction: | ||
| + | Verifying transaction: | ||
| + | Executing transaction: | ||
| + | # | ||
| + | # To activate this environment, | ||
| + | # | ||
| + | # $ conda activate / | ||
| + | # | ||
| + | # To deactivate an active environment, | ||
| + | # | ||
| + | # $ conda deactivate | ||
| + | </ | ||
| + | |||
| + | === VALET package definition === | ||
| + | |||
| + | Assuming the workgroup does //not// already have a TensorFlow VALET package definition, the following YAML config can be modified (e.g. alter the '' | ||
| + | |||
| + | <code yaml> | ||
| + | tensorflow-conda: | ||
| + | prefix: / | ||
| + | description: | ||
| + | url: " | ||
| + | | ||
| + | flags: | ||
| + | - no-standard-paths | ||
| + | |||
| + | versions: | ||
| + | " | ||
| + | description: | ||
| + | dependencies: | ||
| + | - miniforge | ||
| + | actions: | ||
| + | - action: source | ||
| + | script: | ||
| + | sh: miniforge-activate.sh | ||
| + | success: 0 | ||
| + | </ | ||
| + | |||
| + | If the '' | ||
| + | |||
| + | < | ||
| + | : | ||
| + | " | ||
| + | description: | ||
| + | dependencies: | ||
| + | - miniforge | ||
| + | actions: | ||
| + | - action: source | ||
| + | script: | ||
| + | sh: miniforge-activate.sh | ||
| + | success: 0 | ||
| + | | ||
| + | " | ||
| + | description: | ||
| + | : | ||
| + | </ | ||
| + | |||
| + | With a properly-constructed package definition file, you can now check for your versions of TensorFlow: | ||
| + | |||
| + | <code bash> | ||
| + | [(my_workgroup: | ||
| + | |||
| + | Available versions in package (* = default version): | ||
| + | | ||
| + | [/ | ||
| + | tensorflow-conda | ||
| + | * 2.19.1: | ||
| + | : | ||
| + | </ | ||
| + | |||
| + | === Job scripts === | ||
| + | |||
| + | Any job scripts designed to run scripts using this virtualenv should include something like the following toward its end: | ||
| + | |||
| + | < | ||
| + | : | ||
| + | |||
| + | # | ||
| + | # Setup TensorFlow virtualenv: | ||
| + | # | ||
| + | vpkg_require tensorflow-conda/ | ||
| + | |||
| + | # | ||
| + | # Run a Python script in that virtualenv: | ||
| + | # | ||
| + | python3 my_tf_work.py | ||
| + | rc=$? | ||
| + | |||
| + | # | ||
| + | # Do cleanup work, etc.... | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # Exit with whatever exit code our Python script handed back: | ||
| + | # | ||
| + | exit $rc | ||
| + | </ | ||
| ===== Container images ===== | ===== Container images ===== | ||