Flox is a next-generation, language-agnostic package and environment manager. With Flox you get reproducible collections of tools, environment variables, services, and setup scripts in the form of carefully configured subshells. There’s no container isolation preventing you from using your favorite shell, painstakingly crafted dotfiles, or favorite utilities. Since Flox “environments” are reproducible, you get the same exact setup no matter where you use it, whether that’s local development, in CI, bundled into a container, or deployed as a service on a virtual machine. With Flox, “works on my machine” problems are a thing of the past. Flox is officially licensed to distribute NVIDIA’s CUDA Toolkit, which provides libraries for fully utilizing the computational power of NVIDIA GPUs for a variety of workloads, including AI, scientific research, and other enterprise applications. Figuring out the compatibility matrix between an upstream package that depends on CUDA, the CUDA Toolkit itself, and any other dependencies required for the package can be a big time investment. Flox makes that process easier by only requiring you to do the work once. Once the environment is built, anyone on Linux or Windows Subsystem for Linux gets exactly the same set of tools and dependencies. If that wasn’t cool enough, with Flox each project can have a different CUDA Toolkit installed with causing version conflicts. Each project’s dependencies are completely independent of one another. For a quick overview of Flox, see Flox in 5 Minutes. Otherwise, let’s see how easy it is to install and use the CUDA Toolkit with Flox.Documentation Index
Fetch the complete documentation index at: https://flox-daniel-dev-88-add-deactivate-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Official CUDA examples
The flox/cuda-samples repository is a fork of theNVIDIA/cuda-samples repository, and contains a variety of small projects demonstrating different
aspects and capabilities of the CUDA Toolkit.
We’ve added a Flox environment on the flox-env branch that contains the dependencies for all
examples in this repository.
If you already have Flox installed, getting up and running is very easy:
nvcc you would run flox install flox-cuda/cudaPackages.cuda_nvcc.
Furthermore, since each Flox environment is scoped to a particular directory, you can have
projects in different directories on your system that use and install completely different
versions of the CUDA Toolkit with no problems at all.
Let’s pick one of the examples and build it.
HSOpticalFlow example
Navigate to theSamples/5_Domain_Specific/HSOpticalFlow directory.
This example runs headless in your terminal, but don’t worry, we’ll get to some nice visuals in a moment.
First let’s build the example (note that make -j8 builds the example with 8 jobs, but you may want
more or less depending on how many CPU cores are available on your machine):
- Flox doesn’t run natively on Windows (only through WSL2), so the dependencies for the native Windows examples are skipped.
- The NvSci example is skipped because NvSci functionality is only included in NVIDIA Drive OS distributions of the CUDA Toolkit.
git clone and flox activate and you’re up and running.
If you’d like to explore some of the other examples, the mkdir build && ... command is what you’ll
run from inside an example directory the first time you want to build it. Feel free to play around!
Julia set
Now we’re going to generate a rendering of the Julia set. Navigate toSamples/5_Domain_Specific/Mandelbrot then run the following commands:
J key to switch from the Mandelbrot set to the Julia set, then play around with colors.
Here’s an example of what the output can look like after tweaking some of the parameters.
PyTorch
Not only can you build against the CUDA Toolkit itself, but with Flox any package that depends on CUDA can be installed with CUDA acceleration automatically enabled. To demonstrate this, we’ll build and run an example from the PyTorch examples repository, and this time we’ll build the environment from scratch to see how easy it is. Clone the PyTorch repository, navigate to themnist example, and create a Flox environment in it: