Join our newsletter! - Tips, contests and more. Click here to subscribe!
A first cloud GPU session should answer a small question: can you connect, run your Python code on the selected device, save the result, and finish the session cleanly? Trying to train a large model before checking that workflow makes ordinary setup problems expensive and difficult to understand.
Start with a short exercise that has no private data and no large downloads. The aim is to learn the path from your computer to a temporary machine and back. Once that path works, you can replace the toy task with a real dataset and a more useful model.
Define the experiment before renting a machine
Write down the input, the output, and a stopping condition. For a first exercise, the input can be synthetic numbers, the output a saved model and a small results file, and the stopping condition 200 training steps. A fixed amount of work is easier to inspect than a notebook that keeps running while you explore.
Prepare a local folder containing the script and a short README. Record which Python version you intend to use and which files you expect to retrieve. If the eventual project needs a dataset, check its license and size before transferring it. A small public sample is usually enough to test the workflow.
Choose one GPU and a compatible Python environment. The most expensive accelerator is unnecessary for learning SSH, file transfers, and a training loop. Check system RAM, disk space, the advertised GPU memory, and the complete rental conditions as well as the hourly rate.
Choose an environment you can explain
A provider such as AtmosCompute offers hourly GPU rental for machine learning and other compute tasks. Before launching, inspect the individual offer and its connection instructions. Available hardware, software images, storage rules, and prices can change; a provider homepage is a starting point rather than a specification for every instance.
For a beginner, an image with a compatible NVIDIA driver and PyTorch installation can reduce setup work. If you install PyTorch yourself, use the project’s official installation selector for your operating system and compute platform. An arbitrary installation command copied from an old tutorial may install an unsuitable build.
Follow the provider’s supported SSH or notebook access method. Keep credentials out of shared notebooks and public repositories. If you use a browser notebook, keep its authentication enabled and use the access route supplied for the instance.
Check the device before starting useful work
Open a terminal and run nvidia-smi where the image supports it. Check that the expected GPU is visible. Then check the device reported by Python. Seeing an NVIDIA device in a system utility does not by itself prove that your current Python environment can use it.
The script below works on a CPU too, which makes it convenient for a local rehearsal. On a paid GPU session, however, a printed device of cpu is a reason to investigate before running a long job. Check the active virtual environment and the installed PyTorch build.
Run a small training smoke test
Save this as first_experiment.py in an empty working folder. It creates synthetic data, fits a small linear model, and writes two output files. The task is deliberately too small to establish whether a GPU is faster or better value than a CPU.
import json
from pathlib import Path
import torch
torch.manual_seed(42)
device = torch.device(
"cuda" if torch.cuda.is_available() else "cpu"
)
print("Device:", device)
if device.type == "cuda":
print("GPU:", torch.cuda.get_device_name(0))
x = torch.randn(512, 16, device=device)
y = 0.7 * x[:, :1] - 0.2 * x[:, 1:2]
model = torch.nn.Linear(16, 1).to(device)
optimizer = torch.optim.Adam(model.parameters(), lr=0.03)
loss_function = torch.nn.MSELoss()
initial_loss = loss_function(model(x), y).item()
for step in range(200):
optimizer.zero_grad()
loss = loss_function(model(x), y)
loss.backward()
optimizer.step()
final_loss = loss_function(model(x), y).item()
output = Path("experiment_output")
output.mkdir(exist_ok=True)
torch.save(model.cpu().state_dict(), output / "model.pt")
result = {
"device": str(device),
"torch_version": str(torch.__version__),
"steps": 200,
"initial_training_mse": initial_loss,
"final_training_mse": final_loss,
}
(output / "result.json").write_text(
json.dumps(result, indent=2), encoding="utf-8"
)
print(json.dumps(result, indent=2))
Run it with python first_experiment.py. Confirm that the process finishes and that experiment_output contains model.pt and result.json. A decreasing training loss is a useful smoke-test signal here. It is not a measurement of accuracy on unseen data.
Understand what the result does and does not show
This exercise checks tensor operations, gradient calculation, an optimizer, and saving files. It does not check real-world prediction quality, a large model’s memory needs, or reliable long-running training. The synthetic target follows a simple known relationship, and the loss is calculated on the same rows used for training.
For a real project, keep separate training and validation data, define an evaluation metric, and compare with a simple baseline. A fixed seed helps repeat a setup, but it does not promise identical results across different devices, library versions, or numerical settings.
Retrieve your work before ending the session
Copy the output folder, script, and environment details to storage you control. Open the copied JSON locally and check that the model file is present. For a larger project, include configuration files, dataset version information, and the checkpoint needed to resume work.
Do this before destroying a temporary instance. Storage persistence differs between offers, and a directory that survives a restart may still disappear when an instance or disk is deleted.
Close the rental and inspect the charge
Save your files, finish the running process, and use the provider’s documented action for ending the rental. Closing an SSH terminal or browser tab is not confirmation that billing has stopped. Check the instance state and any retained storage separately.
Compare the actual billed duration with your plan, including setup and file transfer time. Keep a short note about what worked and what slowed you down. Your next experiment can then focus on the model or dataset, with a repeatable setup and a clear way to preserve the result.


Leave a Reply