-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvm-init.sh
More file actions
79 lines (71 loc) · 2.22 KB
/
Copy pathvm-init.sh
File metadata and controls
79 lines (71 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Initial VM setup for NAIC Orchestrator VMs
# Run this ONCE on a fresh VM before cloning the repository
set -e
echo "=== NAIC VM Initial Setup ==="
echo ""
# Check if running as root or with sudo
if [ "$EUID" -ne 0 ]; then
SUDO="sudo"
else
SUDO=""
fi
# Check for module system (NAIC VMs with EasyBuild/Lmod)
echo "Checking environment..."
if command -v module &> /dev/null; then
echo "Module system detected (EasyBuild/Lmod)"
echo "Available Python modules:"
module avail python/3 2>&1 | head -20 || true
echo ""
else
echo "No module system detected - installing system packages..."
$SUDO apt update -y
$SUDO apt install -y \
build-essential \
git \
gdb \
libssl-dev \
zlib1g-dev \
python3-dev \
python3-venv \
python3-pip
fi
# Check GPU availability
echo ""
echo "=== GPU Status ==="
if command -v nvidia-smi &> /dev/null; then
echo "NVIDIA GPU detected:"
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv 2>/dev/null || nvidia-smi
# Setup CUDA library symlinks
echo ""
echo "Setting up CUDA library symlinks..."
mkdir -p $HOME/cuda_link
ln -sf /lib/x86_64-linux-gnu/libcuda.so.1 $HOME/cuda_link/libcuda.so.1 2>/dev/null || true
ln -sf /lib/x86_64-linux-gnu/libcuda.so.1 $HOME/cuda_link/libcuda.so 2>/dev/null || true
echo "CUDA symlinks created in ~/cuda_link"
elif command -v rocm-smi &> /dev/null; then
echo "AMD GPU detected:"
rocm-smi
else
if lspci | grep -iE 'vga|3d|display' | grep -i nvidia &> /dev/null; then
echo "NVIDIA GPU hardware detected but drivers not installed"
lspci | grep -iE 'vga|3d|display'
else
echo "No GPU detected (CPU-only mode)"
fi
fi
# Check Python
echo ""
echo "=== Python Status ==="
python3 --version 2>/dev/null || echo "Python3 not found"
which python3 2>/dev/null || echo "Python3 path not found"
echo ""
echo "=== VM Initial Setup Complete ==="
echo ""
echo "Next steps:"
echo " git clone https://github.com/NAICNO/wp7-UC3-pseudo-hamiltonian-neural-networks.git"
echo " cd pseudo-hamiltonian-neural-networks"
echo " chmod +x setup.sh vm-init.sh"
echo " ./setup.sh"
echo " source venv/bin/activate"
echo ""