Welcome to TERN Knowledge Base

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

In computational research, GPU acceleration has become indispensable, especially for handling complex tasks like deep learning. CoESRA’s GPU node gives researcher’s the opportunity to access that computational power remotely.


The CoESRA virtual desktop can process deep learning computations assigned to GPUs for faster processing. This example first creates a synthetic dataset, then utilises it to train a Deep Neural Network (DNN). The computational demands and GPU usage is visually showcased via the nvtop task monitor.

This script has been tailored to generate a significant computational load illustrating the CoESRA virtual desktop GPU node’s computation capabilities.

Should I include comparison times between running this script in the CPU node vs the GPU node to further emphasise how heavy it is? It’s 40+hrs to run using the CPU node vs ~35m using the GPU node


If you would like to trial the CoESRA GPU node, run the below python script in VSCode within the CoESRA virtual desktop.

import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout

# Check the availability of GPU
if tf.config.experimental.list_physical_devices('GPU'):
    print("GPU is available")
else:
    print("GPU not available, using CPU")

# Generate a synthetic dataset for demonstration purposes
X = np.random.rand(300000000, 10)  # Input data with 10 features
y = np.random.rand(300000000, 1)   # Corresponding output data

# Initialize a Sequential DNN model
model = Sequential()

# Input layer: this layer has 20 neurons (units of computation) 
# and receives input data with 10 features
model.add(Dense(20, input_dim=10, activation='relu'))  

# Hidden layers: layers that process the data between input and output
# Each of these layers has 4096 neurons
model.add(Dense(4096, activation='relu')) 
model.add(Dropout(0.5))  # Introducing some randomness by "dropping out" some neurons to prevent overfitting
model.add(Dense(4096, activation='relu')) 
model.add(Dense(4096, activation='relu'))
model.add(Dense(4096, activation='relu'))

# Output layer: produces the final prediction. Only 1 neuron as our synthetic 
# data has a single output value per sample
model.add(Dense(1, activation='linear'))

# Set up the model for training. Here:
# - 'mean_squared_error' is the criteria to measure how well the model is performing (lower is better).
# - 'adam' is a type of optimisation algorithm that adjusts neuron weights to improve the model's predictions.
model.compile(loss='mean_squared_error', optimizer='adam')

# Train the model using the synthetic data. 
# The model will process the data in batches of 1024 samples at a time, for 1 full cycle (epoch).
model.fit(X, y, epochs=1, batch_size=1024)

print("Training complete!")
  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.