Skip to main content

What Eugo Optimizes

Eugo's optimizations live in the software in your workspace: the libraries you import are built for the hardware your code runs on. Two things are your choice, and you make them in your code: which work runs on a GPU, and which work runs on your cluster. This page covers all three.

Libraries Built for Your Hardware​

The libraries in your workspace, such as NumPy, SciPy, pandas and PyTorch (see Libraries), are built for the Arm (aarch64) processors Eugo runs on. They use those processors' SIMD (Single Instruction, Multiple Data) instructions, which work on several numbers in one step.

You get this as soon as you import the library. There is nothing to annotate and nothing to install. Element-wise arithmetic on large NumPy arrays, for example, runs on these instructions.

Using the GPU​

On a machine with an NVIDIA GPU (graphics processing unit), GPU libraries such as PyTorch are built for that GPU. Eugo does not move your code to the GPU by itself: work runs on the GPU when your code puts it there. In PyTorch, you create tensors and models on the cuda device:

import torch

device = "cuda" if torch.cuda.is_available() else "cpu"
x = torch.rand(4096, 4096, device=device) # created on the GPU when there is one
y = x @ x # runs where x lives

Your EugoIDE notebook has no GPU, so in the notebook this code picks cpu. The GPUs are on your cluster, in its GPU worker pools. The reliable way to run work on one is a cluster task that asks for a GPU, on a cluster that has a GPU worker pool, after you click Connect (step 1 of the next section). In a notebook that is not connected, this cell starts a Ray inside the notebook, which has no GPU, and keeps waiting until you interrupt it:

import eugo.hpc
import torch

@eugo.hpc.distribute(num_gpus=1)
def gpu_matmul(n):
x = torch.rand(n, n, device="cuda")
return (x @ x).sum().item()

total = eugo.hpc.get(gpu_matmul.remote(4096))

num_gpus=1 asks for one GPU: the task is placed on a node with a free GPU, and that GPU is given to the task before it runs. This is Ray's rule for tasks that need a GPU. On a cluster with no GPU worker pool, the task waits and does not start. The next section covers cluster tasks and the Connect step they need.

NumPy code runs on the CPU.

Spreading Work Across Your Cluster​

Eugo does not split your code across machines by itself. You choose which functions run on your cluster, with eugo.hpc:

  1. Start a cluster in the EugoHPC Manager panel of EugoIDE and click its Connect button.
  2. Mark a function with @eugo.hpc.distribute.
  3. Call it with .remote(...). Each call starts a task on the cluster and returns at once with a future, a placeholder for the result.
  4. Read the results with eugo.hpc.get(...). It waits for the tasks and returns their values. It takes one future or a list of them.
import eugo.hpc

@eugo.hpc.distribute
def square(x):
return x * x

futures = [square.remote(i) for i in range(8)] # starts 8 tasks on the cluster
results = eugo.hpc.get(futures) # waits for them and returns their values
print(results)

Output:

[0, 1, 4, 9, 16, 25, 36, 49]

If the first cell that calls the cluster after the kernel starts also prints a line containing Started a local Ray instance, the notebook is not connected to your cluster: that cell's tasks, and those of every later cell, run inside the notebook, and the output looks the same. The line appears only on that first call, so look for it there; later cells do not print it again. That happens when you skip Connect, or restart the kernel after it. Restart the kernel, then click Connect again before you run the cell.

A function marked with @eugo.hpc.distribute is always called with .remote(...). Calling it directly, as square(12), raises a TypeError.

eugo.hpc is built on Ray: eugo.hpc.distribute is Ray's remote and eugo.hpc.get is Ray's get, so Ray's documentation applies to both.

Python Version​

Your EugoIDE workspace runs Python 3.14.

Best Practices​

These habits let the libraries and your cluster do more of the work:

  • Use NumPy arrays instead of Python lists for numerical work, so the libraries' optimized code does the arithmetic
  • Avoid unnecessary loops: whole-array operations run in the libraries' optimized code, explicit Python loops do not
  • Give each cluster task a sizeable piece of work: every .remote(...) call has a small fixed cost, so a few larger tasks usually finish sooner than many tiny ones
  • Start all your tasks before you call eugo.hpc.get: calling it right after each .remote(...) waits for each task before starting the next, so they run one at a time
  • Use standard library functions: built-in operations have optimized paths

Your existing code runs unchanged in EugoIDE; these practices help it use what Eugo provides.