Differences
This shows you the differences between two versions of the page.
software:tensorflow:darwin [2024-05-20 11:14] – created frey | software:tensorflow:darwin [2024-05-20 11:51] (current) – frey | ||
---|---|---|---|
Line 43: | Line 43: | ||
<code bash> | <code bash> | ||
- | ... | + | : |
# | # | ||
Line 66: | Line 66: | ||
The DARWIN cluster includes nodes with NVIDIA (CUDA-based) GPGPUs and AMD (ROCM-based) GPUs. TensorFlow images with support for these coprocessors are available. | The DARWIN cluster includes nodes with NVIDIA (CUDA-based) GPGPUs and AMD (ROCM-based) GPUs. TensorFlow images with support for these coprocessors are available. | ||
+ | ===== Virtual environments ===== | ||
+ | |||
+ | As of 2024, Anaconda virtual environments are suggested for TensorFlow virtual environments. | ||
+ | |||
+ | Start by adding the Anaconda distribution base to the environment (here '' | ||
+ | |||
+ | <code bash> | ||
+ | [(my_workgroup: | ||
+ | Adding package `anaconda/ | ||
+ | [(my_workgroup: | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | <code bash> | ||
+ | [(my_workgroup: | ||
+ | Loading channels: done | ||
+ | # Name | ||
+ | tensorflow | ||
+ | tensorflow | ||
+ | : | ||
+ | tensorflow | ||
+ | : | ||
+ | tensorflow | ||
+ | : | ||
+ | tensorflow | ||
+ | </ | ||
+ | |||
+ | Note that the build tag provides the distinction between variants built on top of specific devices or libraries. | ||
+ | |||
+ | All versions of the TensorFlow virtualenv will be stored in the common base directory, '' | ||
+ | |||
+ | <code bash> | ||
+ | [(my_workgroup: | ||
+ | 2.12.0-mkl | ||
+ | </ | ||
+ | |||
+ | 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: | ||
+ | prefix: / | ||
+ | description: | ||
+ | url: " | ||
+ | | ||
+ | flags: | ||
+ | - no-standard-paths | ||
+ | |||
+ | versions: | ||
+ | " | ||
+ | description: | ||
+ | dependencies: | ||
+ | - anaconda/ | ||
+ | actions: | ||
+ | - action: source | ||
+ | script: | ||
+ | sh: anaconda-activate-2024.sh | ||
+ | success: 0 | ||
+ | </ | ||
+ | |||
+ | If the '' | ||
+ | |||
+ | < | ||
+ | : | ||
+ | " | ||
+ | description: | ||
+ | dependencies: | ||
+ | - anaconda/ | ||
+ | actions: | ||
+ | - action: source | ||
+ | script: | ||
+ | sh: anaconda-activate-2024.sh | ||
+ | success: 0 | ||
+ | | ||
+ | " | ||
+ | description: | ||
+ | : | ||
+ | </ | ||
+ | |||
+ | With a properly-constructed package definition file, you can now check for your versions of TensorFlow: | ||
+ | |||
+ | <code bash> | ||
+ | [(it_nss: | ||
+ | |||
+ | Available versions in package (* = default version): | ||
+ | | ||
+ | [/ | ||
+ | tensorflow | ||
+ | * 2.12.0: | ||
+ | : | ||
+ | </ | ||
+ | |||
+ | ==== 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/ | ||
+ | |||
+ | # | ||
+ | # 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 | ||
+ | </ | ||