aws-bootstrap-g4dn 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aws_bootstrap/cli.py +2 -2
- aws_bootstrap/resources/gpu_benchmark.py +15 -5
- aws_bootstrap/resources/launch.json +42 -0
- aws_bootstrap/resources/remote_setup.sh +83 -5
- aws_bootstrap/resources/saxpy.cu +49 -0
- aws_bootstrap/resources/tasks.json +48 -0
- aws_bootstrap/ssh.py +36 -0
- aws_bootstrap/tests/test_cli.py +1 -1
- {aws_bootstrap_g4dn-0.3.0.dist-info → aws_bootstrap_g4dn-0.4.0.dist-info}/METADATA +26 -3
- {aws_bootstrap_g4dn-0.3.0.dist-info → aws_bootstrap_g4dn-0.4.0.dist-info}/RECORD +14 -11
- {aws_bootstrap_g4dn-0.3.0.dist-info → aws_bootstrap_g4dn-0.4.0.dist-info}/WHEEL +0 -0
- {aws_bootstrap_g4dn-0.3.0.dist-info → aws_bootstrap_g4dn-0.4.0.dist-info}/entry_points.txt +0 -0
- {aws_bootstrap_g4dn-0.3.0.dist-info → aws_bootstrap_g4dn-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {aws_bootstrap_g4dn-0.3.0.dist-info → aws_bootstrap_g4dn-0.4.0.dist-info}/top_level.txt +0 -0
aws_bootstrap/cli.py
CHANGED
|
@@ -277,7 +277,7 @@ def launch(
|
|
|
277
277
|
click.echo()
|
|
278
278
|
click.secho(" VSCode Remote SSH:", fg="cyan")
|
|
279
279
|
click.secho(
|
|
280
|
-
f" code --folder-uri vscode-remote://ssh-remote+{alias}/home/{config.ssh_user}",
|
|
280
|
+
f" code --folder-uri vscode-remote://ssh-remote+{alias}/home/{config.ssh_user}/workspace",
|
|
281
281
|
bold=True,
|
|
282
282
|
)
|
|
283
283
|
|
|
@@ -410,7 +410,7 @@ def status(region, profile, gpu, instructions):
|
|
|
410
410
|
|
|
411
411
|
click.secho(" VSCode Remote SSH:", fg="cyan")
|
|
412
412
|
click.secho(
|
|
413
|
-
f" code --folder-uri vscode-remote://ssh-remote+{alias}/home/{user}",
|
|
413
|
+
f" code --folder-uri vscode-remote://ssh-remote+{alias}/home/{user}/workspace",
|
|
414
414
|
bold=True,
|
|
415
415
|
)
|
|
416
416
|
|
|
@@ -628,7 +628,9 @@ def configure_precision(device: torch.device, requested: PrecisionMode) -> Preci
|
|
|
628
628
|
return PrecisionMode.FP32
|
|
629
629
|
|
|
630
630
|
|
|
631
|
-
def print_system_info(
|
|
631
|
+
def print_system_info(
|
|
632
|
+
requested_precision: PrecisionMode, force_cpu: bool = False
|
|
633
|
+
) -> tuple[torch.device, PrecisionMode]:
|
|
632
634
|
"""Print system and CUDA information, return device and actual precision mode."""
|
|
633
635
|
print("\n" + "=" * 60)
|
|
634
636
|
print("System Information")
|
|
@@ -636,7 +638,7 @@ def print_system_info(requested_precision: PrecisionMode) -> tuple[torch.device,
|
|
|
636
638
|
print(f"PyTorch version: {torch.__version__}")
|
|
637
639
|
print(f"Python version: {sys.version.split()[0]}")
|
|
638
640
|
|
|
639
|
-
if torch.cuda.is_available():
|
|
641
|
+
if torch.cuda.is_available() and not force_cpu:
|
|
640
642
|
device = torch.device("cuda")
|
|
641
643
|
print("CUDA available: Yes")
|
|
642
644
|
print(f"CUDA version: {torch.version.cuda}")
|
|
@@ -666,8 +668,11 @@ def print_system_info(requested_precision: PrecisionMode) -> tuple[torch.device,
|
|
|
666
668
|
else:
|
|
667
669
|
device = torch.device("cpu")
|
|
668
670
|
actual_precision = PrecisionMode.FP32
|
|
669
|
-
|
|
670
|
-
|
|
671
|
+
if force_cpu:
|
|
672
|
+
print("CPU-only mode requested (--cpu flag)")
|
|
673
|
+
else:
|
|
674
|
+
print("CUDA available: No (running on CPU)")
|
|
675
|
+
print("Running on CPU for benchmarking")
|
|
671
676
|
|
|
672
677
|
print("=" * 60)
|
|
673
678
|
return device, actual_precision
|
|
@@ -724,10 +729,15 @@ def main() -> None:
|
|
|
724
729
|
action="store_true",
|
|
725
730
|
help="Run CUDA/cuBLAS diagnostic tests before benchmarking",
|
|
726
731
|
)
|
|
732
|
+
parser.add_argument(
|
|
733
|
+
"--cpu",
|
|
734
|
+
action="store_true",
|
|
735
|
+
help="Force CPU-only execution (for CPU vs GPU comparison)",
|
|
736
|
+
)
|
|
727
737
|
args = parser.parse_args()
|
|
728
738
|
|
|
729
739
|
requested_precision = PrecisionMode(args.precision)
|
|
730
|
-
device, actual_precision = print_system_info(requested_precision)
|
|
740
|
+
device, actual_precision = print_system_info(requested_precision, force_cpu=args.cpu)
|
|
731
741
|
|
|
732
742
|
# Run diagnostics if requested
|
|
733
743
|
if args.diagnose:
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
// CUDA debug configurations for VSCode
|
|
3
|
+
// Deployed to: ~/workspace/.vscode/launch.json
|
|
4
|
+
//
|
|
5
|
+
// Usage: Open any .cu file, press F5 to build and debug
|
|
6
|
+
"version": "0.2.0",
|
|
7
|
+
"configurations": [
|
|
8
|
+
{
|
|
9
|
+
"name": "CUDA: Build and Debug Active File",
|
|
10
|
+
"type": "cuda-gdb",
|
|
11
|
+
"request": "launch",
|
|
12
|
+
"program": "${fileDirname}/${fileBasenameNoExtension}",
|
|
13
|
+
"args": [],
|
|
14
|
+
"cwd": "${fileDirname}",
|
|
15
|
+
"miDebuggerPath": "__CUDA_GDB_PATH__",
|
|
16
|
+
"stopAtEntry": false,
|
|
17
|
+
"preLaunchTask": "nvcc: build active file (debug)"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "CUDA: Build and Debug (stop at main)",
|
|
21
|
+
"type": "cuda-gdb",
|
|
22
|
+
"request": "launch",
|
|
23
|
+
"program": "${fileDirname}/${fileBasenameNoExtension}",
|
|
24
|
+
"args": [],
|
|
25
|
+
"cwd": "${fileDirname}",
|
|
26
|
+
"miDebuggerPath": "__CUDA_GDB_PATH__",
|
|
27
|
+
"stopAtEntry": true,
|
|
28
|
+
"preLaunchTask": "nvcc: build active file (debug)"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "CUDA: Run Active File (no debug)",
|
|
32
|
+
"type": "cuda-gdb",
|
|
33
|
+
"request": "launch",
|
|
34
|
+
"program": "${fileDirname}/${fileBasenameNoExtension}",
|
|
35
|
+
"args": [],
|
|
36
|
+
"cwd": "${fileDirname}",
|
|
37
|
+
"miDebuggerPath": "__CUDA_GDB_PATH__",
|
|
38
|
+
"stopAtEntry": false,
|
|
39
|
+
"preLaunchTask": "nvcc: build active file (release)"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -7,7 +7,7 @@ echo "=== aws-bootstrap-g4dn remote setup ==="
|
|
|
7
7
|
|
|
8
8
|
# 1. Verify GPU
|
|
9
9
|
echo ""
|
|
10
|
-
echo "[1/
|
|
10
|
+
echo "[1/6] Verifying GPU and CUDA..."
|
|
11
11
|
if command -v nvidia-smi &>/dev/null; then
|
|
12
12
|
nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv,noheader
|
|
13
13
|
else
|
|
@@ -20,15 +20,40 @@ else
|
|
|
20
20
|
echo "WARNING: nvcc not found (CUDA toolkit may not be installed)"
|
|
21
21
|
fi
|
|
22
22
|
|
|
23
|
+
# Make Nsight Systems (nsys) available on PATH if installed under /opt/nvidia
|
|
24
|
+
if ! command -v nsys &>/dev/null; then
|
|
25
|
+
NSIGHT_DIR="/opt/nvidia/nsight-systems"
|
|
26
|
+
if [ -d "$NSIGHT_DIR" ]; then
|
|
27
|
+
# Fix permissions — the parent dir is often root-only (drwx------)
|
|
28
|
+
sudo chmod o+rx "$NSIGHT_DIR"
|
|
29
|
+
# Find the latest version directory (lexicographic sort)
|
|
30
|
+
NSYS_VERSION=$(ls -1 "$NSIGHT_DIR" | sort -V | tail -1)
|
|
31
|
+
if [ -n "$NSYS_VERSION" ] && [ -x "$NSIGHT_DIR/$NSYS_VERSION/bin/nsys" ]; then
|
|
32
|
+
NSYS_BIN="$NSIGHT_DIR/$NSYS_VERSION/bin"
|
|
33
|
+
if ! grep -q "nsight-systems" ~/.bashrc 2>/dev/null; then
|
|
34
|
+
echo "export PATH=\"$NSYS_BIN:\$PATH\"" >> ~/.bashrc
|
|
35
|
+
fi
|
|
36
|
+
export PATH="$NSYS_BIN:$PATH"
|
|
37
|
+
echo " Nsight Systems $NSYS_VERSION added to PATH ($NSYS_BIN)"
|
|
38
|
+
else
|
|
39
|
+
echo " WARNING: Nsight Systems directory found but no nsys binary"
|
|
40
|
+
fi
|
|
41
|
+
else
|
|
42
|
+
echo " Nsight Systems not found at $NSIGHT_DIR"
|
|
43
|
+
fi
|
|
44
|
+
else
|
|
45
|
+
echo " nsys already on PATH: $(command -v nsys)"
|
|
46
|
+
fi
|
|
47
|
+
|
|
23
48
|
# 2. Install utilities
|
|
24
49
|
echo ""
|
|
25
|
-
echo "[2/
|
|
50
|
+
echo "[2/6] Installing utilities..."
|
|
26
51
|
sudo apt-get update -qq
|
|
27
52
|
sudo apt-get install -y -qq htop tmux tree jq
|
|
28
53
|
|
|
29
54
|
# 3. Set up Python environment with uv
|
|
30
55
|
echo ""
|
|
31
|
-
echo "[3/
|
|
56
|
+
echo "[3/6] Setting up Python environment with uv..."
|
|
32
57
|
if ! command -v uv &>/dev/null; then
|
|
33
58
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
34
59
|
fi
|
|
@@ -153,7 +178,7 @@ echo " Jupyter config written to $JUPYTER_CONFIG_DIR/jupyter_lab_config.py"
|
|
|
153
178
|
|
|
154
179
|
# 4. Jupyter systemd service
|
|
155
180
|
echo ""
|
|
156
|
-
echo "[4/
|
|
181
|
+
echo "[4/6] Setting up Jupyter systemd service..."
|
|
157
182
|
LOGIN_USER=$(whoami)
|
|
158
183
|
|
|
159
184
|
sudo tee /etc/systemd/system/jupyter.service > /dev/null << SVCEOF
|
|
@@ -180,7 +205,7 @@ echo " Jupyter service started (port 8888)"
|
|
|
180
205
|
|
|
181
206
|
# 5. SSH keepalive
|
|
182
207
|
echo ""
|
|
183
|
-
echo "[5/
|
|
208
|
+
echo "[5/6] Configuring SSH keepalive..."
|
|
184
209
|
if ! grep -q "ClientAliveInterval" /etc/ssh/sshd_config; then
|
|
185
210
|
echo "ClientAliveInterval 60" | sudo tee -a /etc/ssh/sshd_config > /dev/null
|
|
186
211
|
echo "ClientAliveCountMax 10" | sudo tee -a /etc/ssh/sshd_config > /dev/null
|
|
@@ -190,5 +215,58 @@ else
|
|
|
190
215
|
echo " SSH keepalive already configured"
|
|
191
216
|
fi
|
|
192
217
|
|
|
218
|
+
# 6. VSCode workspace setup
|
|
219
|
+
echo ""
|
|
220
|
+
echo "[6/6] Setting up VSCode workspace..."
|
|
221
|
+
mkdir -p ~/workspace/.vscode
|
|
222
|
+
|
|
223
|
+
# Detect cuda-gdb path
|
|
224
|
+
CUDA_GDB_PATH=""
|
|
225
|
+
if command -v cuda-gdb &>/dev/null; then
|
|
226
|
+
CUDA_GDB_PATH=$(command -v cuda-gdb)
|
|
227
|
+
elif [ -x /usr/local/cuda/bin/cuda-gdb ]; then
|
|
228
|
+
CUDA_GDB_PATH="/usr/local/cuda/bin/cuda-gdb"
|
|
229
|
+
else
|
|
230
|
+
# Try glob for versioned CUDA installs
|
|
231
|
+
for p in /usr/local/cuda-*/bin/cuda-gdb; do
|
|
232
|
+
if [ -x "$p" ]; then
|
|
233
|
+
CUDA_GDB_PATH="$p"
|
|
234
|
+
fi
|
|
235
|
+
done
|
|
236
|
+
fi
|
|
237
|
+
if [ -z "$CUDA_GDB_PATH" ]; then
|
|
238
|
+
echo " WARNING: cuda-gdb not found — using placeholder in launch.json"
|
|
239
|
+
CUDA_GDB_PATH="cuda-gdb"
|
|
240
|
+
else
|
|
241
|
+
echo " cuda-gdb: $CUDA_GDB_PATH"
|
|
242
|
+
fi
|
|
243
|
+
|
|
244
|
+
# Detect GPU SM architecture
|
|
245
|
+
GPU_ARCH=""
|
|
246
|
+
if command -v nvidia-smi &>/dev/null; then
|
|
247
|
+
COMPUTE_CAP=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | head -1 | tr -d '[:space:]')
|
|
248
|
+
if [ -n "$COMPUTE_CAP" ]; then
|
|
249
|
+
GPU_ARCH="sm_$(echo "$COMPUTE_CAP" | tr -d '.')"
|
|
250
|
+
fi
|
|
251
|
+
fi
|
|
252
|
+
if [ -z "$GPU_ARCH" ]; then
|
|
253
|
+
echo " WARNING: Could not detect GPU arch — defaulting to sm_75"
|
|
254
|
+
GPU_ARCH="sm_75"
|
|
255
|
+
else
|
|
256
|
+
echo " GPU arch: $GPU_ARCH"
|
|
257
|
+
fi
|
|
258
|
+
|
|
259
|
+
# Copy example CUDA source into workspace
|
|
260
|
+
cp /tmp/saxpy.cu ~/workspace/saxpy.cu
|
|
261
|
+
echo " Deployed saxpy.cu"
|
|
262
|
+
|
|
263
|
+
# Deploy launch.json with cuda-gdb path
|
|
264
|
+
sed "s|__CUDA_GDB_PATH__|${CUDA_GDB_PATH}|g" /tmp/launch.json > ~/workspace/.vscode/launch.json
|
|
265
|
+
echo " Deployed launch.json"
|
|
266
|
+
|
|
267
|
+
# Deploy tasks.json with GPU architecture
|
|
268
|
+
sed "s|__GPU_ARCH__|${GPU_ARCH}|g" /tmp/tasks.json > ~/workspace/.vscode/tasks.json
|
|
269
|
+
echo " Deployed tasks.json"
|
|
270
|
+
|
|
193
271
|
echo ""
|
|
194
272
|
echo "=== Remote setup complete ==="
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAXPY Example, CUDA Style
|
|
3
|
+
* Source: https://developer.nvidia.com/blog/easy-introduction-cuda-c-and-c/
|
|
4
|
+
*
|
|
5
|
+
* This is included as an example CUDA C++ source file to try out the VS Code launch configuration we include on the host machine.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
#include <stdio.h>
|
|
9
|
+
|
|
10
|
+
__global__
|
|
11
|
+
void saxpy(int n, float a, float *x, float *y)
|
|
12
|
+
{
|
|
13
|
+
int i = blockIdx.x*blockDim.x + threadIdx.x;
|
|
14
|
+
if (i < n) y[i] = a*x[i] + y[i];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
int main(void)
|
|
18
|
+
{
|
|
19
|
+
int N = 1<<20;
|
|
20
|
+
float *x, *y, *d_x, *d_y;
|
|
21
|
+
x = (float*)malloc(N*sizeof(float));
|
|
22
|
+
y = (float*)malloc(N*sizeof(float));
|
|
23
|
+
|
|
24
|
+
cudaMalloc(&d_x, N*sizeof(float));
|
|
25
|
+
cudaMalloc(&d_y, N*sizeof(float));
|
|
26
|
+
|
|
27
|
+
for (int i = 0; i < N; i++) {
|
|
28
|
+
x[i] = 1.0f;
|
|
29
|
+
y[i] = 2.0f;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
cudaMemcpy(d_x, x, N*sizeof(float), cudaMemcpyHostToDevice);
|
|
33
|
+
cudaMemcpy(d_y, y, N*sizeof(float), cudaMemcpyHostToDevice);
|
|
34
|
+
|
|
35
|
+
// Perform SAXPY on 1M elements
|
|
36
|
+
saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);
|
|
37
|
+
|
|
38
|
+
cudaMemcpy(y, d_y, N*sizeof(float), cudaMemcpyDeviceToHost);
|
|
39
|
+
|
|
40
|
+
float maxError = 0.0f;
|
|
41
|
+
for (int i = 0; i < N; i++)
|
|
42
|
+
maxError = max(maxError, abs(y[i]-4.0f));
|
|
43
|
+
printf("Max error: %f\n", maxError);
|
|
44
|
+
|
|
45
|
+
cudaFree(d_x);
|
|
46
|
+
cudaFree(d_y);
|
|
47
|
+
free(x);
|
|
48
|
+
free(y);
|
|
49
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
// CUDA build tasks for VSCode
|
|
3
|
+
// Deployed to: ~/workspace/.vscode/tasks.json
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"label": "nvcc: build active file (debug)",
|
|
8
|
+
"type": "shell",
|
|
9
|
+
"command": "nvcc",
|
|
10
|
+
"args": [
|
|
11
|
+
"-g", // Host debug symbols
|
|
12
|
+
"-G", // Device (GPU) debug symbols
|
|
13
|
+
"-O0", // No optimization
|
|
14
|
+
"-arch=__GPU_ARCH__", // GPU arch (auto-detected)
|
|
15
|
+
"-o",
|
|
16
|
+
"${fileDirname}/${fileBasenameNoExtension}",
|
|
17
|
+
"${file}"
|
|
18
|
+
],
|
|
19
|
+
"options": {
|
|
20
|
+
"cwd": "${fileDirname}"
|
|
21
|
+
},
|
|
22
|
+
"problemMatcher": ["$nvcc"],
|
|
23
|
+
"group": {
|
|
24
|
+
"kind": "build",
|
|
25
|
+
"isDefault": true
|
|
26
|
+
},
|
|
27
|
+
"detail": "Compile active .cu file with debug symbols (-g -G)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"label": "nvcc: build active file (release)",
|
|
31
|
+
"type": "shell",
|
|
32
|
+
"command": "nvcc",
|
|
33
|
+
"args": [
|
|
34
|
+
"-O3",
|
|
35
|
+
"-arch=__GPU_ARCH__",
|
|
36
|
+
"-o",
|
|
37
|
+
"${fileDirname}/${fileBasenameNoExtension}",
|
|
38
|
+
"${file}"
|
|
39
|
+
],
|
|
40
|
+
"options": {
|
|
41
|
+
"cwd": "${fileDirname}"
|
|
42
|
+
},
|
|
43
|
+
"problemMatcher": ["$nvcc"],
|
|
44
|
+
"group": "build",
|
|
45
|
+
"detail": "Compile active .cu file optimized (no debug)"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
aws_bootstrap/ssh.py
CHANGED
|
@@ -159,6 +159,42 @@ def run_remote_setup(
|
|
|
159
159
|
click.secho(f" SCP failed: {nb_result.stderr}", fg="red", err=True)
|
|
160
160
|
return False
|
|
161
161
|
|
|
162
|
+
# SCP the CUDA example source
|
|
163
|
+
saxpy_path = script_path.parent / "saxpy.cu"
|
|
164
|
+
click.echo(" Uploading saxpy.cu...")
|
|
165
|
+
saxpy_result = subprocess.run(
|
|
166
|
+
["scp", *ssh_opts, *scp_port_opts, str(saxpy_path), f"{user}@{host}:/tmp/saxpy.cu"],
|
|
167
|
+
capture_output=True,
|
|
168
|
+
text=True,
|
|
169
|
+
)
|
|
170
|
+
if saxpy_result.returncode != 0:
|
|
171
|
+
click.secho(f" SCP failed: {saxpy_result.stderr}", fg="red", err=True)
|
|
172
|
+
return False
|
|
173
|
+
|
|
174
|
+
# SCP the VSCode launch.json
|
|
175
|
+
launch_json_path = script_path.parent / "launch.json"
|
|
176
|
+
click.echo(" Uploading launch.json...")
|
|
177
|
+
launch_result = subprocess.run(
|
|
178
|
+
["scp", *ssh_opts, *scp_port_opts, str(launch_json_path), f"{user}@{host}:/tmp/launch.json"],
|
|
179
|
+
capture_output=True,
|
|
180
|
+
text=True,
|
|
181
|
+
)
|
|
182
|
+
if launch_result.returncode != 0:
|
|
183
|
+
click.secho(f" SCP failed: {launch_result.stderr}", fg="red", err=True)
|
|
184
|
+
return False
|
|
185
|
+
|
|
186
|
+
# SCP the VSCode tasks.json
|
|
187
|
+
tasks_json_path = script_path.parent / "tasks.json"
|
|
188
|
+
click.echo(" Uploading tasks.json...")
|
|
189
|
+
tasks_result = subprocess.run(
|
|
190
|
+
["scp", *ssh_opts, *scp_port_opts, str(tasks_json_path), f"{user}@{host}:/tmp/tasks.json"],
|
|
191
|
+
capture_output=True,
|
|
192
|
+
text=True,
|
|
193
|
+
)
|
|
194
|
+
if tasks_result.returncode != 0:
|
|
195
|
+
click.secho(f" SCP failed: {tasks_result.stderr}", fg="red", err=True)
|
|
196
|
+
return False
|
|
197
|
+
|
|
162
198
|
# SCP the script
|
|
163
199
|
click.echo(" Uploading remote_setup.sh...")
|
|
164
200
|
scp_result = subprocess.run(
|
aws_bootstrap/tests/test_cli.py
CHANGED
|
@@ -565,7 +565,7 @@ def test_status_instructions_shown_by_default(mock_find, mock_spot, mock_session
|
|
|
565
565
|
assert result.exit_code == 0
|
|
566
566
|
assert "ssh aws-gpu1" in result.output
|
|
567
567
|
assert "ssh -NL 8888:localhost:8888 aws-gpu1" in result.output
|
|
568
|
-
assert "vscode-remote://ssh-remote+aws-gpu1/home/ubuntu" in result.output
|
|
568
|
+
assert "vscode-remote://ssh-remote+aws-gpu1/home/ubuntu/workspace" in result.output
|
|
569
569
|
assert "python ~/gpu_benchmark.py" in result.output
|
|
570
570
|
|
|
571
571
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aws-bootstrap-g4dn
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Bootstrap AWS EC2 GPU instances for hybrid local-remote development
|
|
5
5
|
Author: Adam Ever-Hadani
|
|
6
6
|
License-Expression: MIT
|
|
@@ -49,7 +49,7 @@ ssh aws-gpu1 # You're in, venv activated, PyTorch works
|
|
|
49
49
|
### 🎯 Target Workflows
|
|
50
50
|
|
|
51
51
|
1. **Jupyter server-client** — Jupyter runs on the instance, connect from your local browser
|
|
52
|
-
2. **VSCode Remote SSH** — `
|
|
52
|
+
2. **VSCode Remote SSH** — opens `~/workspace` with pre-configured CUDA debug/build tasks and an example `.cu` file
|
|
53
53
|
3. **NVIDIA Nsight remote debugging** — GPU debugging over SSH
|
|
54
54
|
|
|
55
55
|
---
|
|
@@ -162,6 +162,7 @@ The setup script runs automatically on the instance after SSH becomes available:
|
|
|
162
162
|
| **GPU smoke test notebook** | Copies `gpu_smoke_test.ipynb` to `~/gpu_smoke_test.ipynb` (open in JupyterLab) |
|
|
163
163
|
| **Jupyter** | Configures and starts JupyterLab as a systemd service on port 8888 |
|
|
164
164
|
| **SSH keepalive** | Configures server-side keepalive to prevent idle disconnects |
|
|
165
|
+
| **VSCode workspace** | Creates `~/workspace/.vscode/` with `launch.json` and `tasks.json` (auto-detected `cuda-gdb` path and GPU arch), plus an example `saxpy.cu` |
|
|
165
166
|
|
|
166
167
|
### 📊 GPU Benchmark
|
|
167
168
|
|
|
@@ -200,6 +201,28 @@ ssh -i ~/.ssh/id_ed25519 -NL 8888:localhost:8888 ubuntu@<public-ip>
|
|
|
200
201
|
|
|
201
202
|
A **GPU smoke test notebook** (`~/gpu_smoke_test.ipynb`) is pre-installed on every instance. Open it in JupyterLab to interactively verify the CUDA stack, run FP32/FP16 matmuls, train a small CNN on MNIST, and visualise training loss and GPU memory usage.
|
|
202
203
|
|
|
204
|
+
### 🖥️ VSCode Remote SSH
|
|
205
|
+
|
|
206
|
+
The remote setup creates a `~/workspace` folder with pre-configured CUDA debug and build tasks:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
~/workspace/
|
|
210
|
+
├── .vscode/
|
|
211
|
+
│ ├── launch.json # CUDA debug configs (cuda-gdb path auto-detected)
|
|
212
|
+
│ └── tasks.json # nvcc build tasks (GPU arch auto-detected, e.g. sm_75)
|
|
213
|
+
└── saxpy.cu # Example CUDA source — open and press F5 to debug
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Connect directly from your terminal:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
code --folder-uri vscode-remote://ssh-remote+aws-gpu1/home/ubuntu/workspace
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Then install the [Nsight VSCE extension](https://marketplace.visualstudio.com/items?itemName=NVIDIA.nsight-vscode-edition) on the remote when prompted. Open `saxpy.cu`, set a breakpoint, and press F5.
|
|
223
|
+
|
|
224
|
+
See [Nsight remote profiling guide](docs/nsight-remote-profiling.md) for more details on CUDA debugging and profiling workflows.
|
|
225
|
+
|
|
203
226
|
### 📋 Listing Resources
|
|
204
227
|
|
|
205
228
|
```bash
|
|
@@ -322,7 +345,7 @@ aws-bootstrap launch --instance-type t3.medium --ami-filter "ubuntu/images/hvm-s
|
|
|
322
345
|
| GPU instance pricing | [instances.vantage.sh](https://instances.vantage.sh/aws/ec2/g4dn.xlarge) |
|
|
323
346
|
| Spot instance quotas | [AWS docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-limits.html) |
|
|
324
347
|
| Deep Learning AMIs | [AWS docs](https://docs.aws.amazon.com/dlami/latest/devguide/what-is-dlami.html) |
|
|
325
|
-
|
|
|
348
|
+
| Nsight remote GPU profiling | [Guide](docs/nsight-remote-profiling.md) — Nsight Compute, Nsight Systems, and Nsight VSCE on EC2 |
|
|
326
349
|
|
|
327
350
|
Tutorials on setting up a CUDA environment on EC2 GPU instances:
|
|
328
351
|
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
aws_bootstrap/__init__.py,sha256=kl_jvrunGyIyizdRqAP6ROb5P1BBrXX5PTq5gq1ipU0,82
|
|
2
|
-
aws_bootstrap/cli.py,sha256=
|
|
2
|
+
aws_bootstrap/cli.py,sha256=XqCKxyc294krVtggrsqm2cYrHR6DWaqQeuzrRAN5u_c,20501
|
|
3
3
|
aws_bootstrap/config.py,sha256=TeCOYDlijT-KD5SFIzc-VvBhOqcq9YCgen9NK63rka8,895
|
|
4
4
|
aws_bootstrap/ec2.py,sha256=LHpzW91ayK45gsWV_B4LanSZIhWggqTsL31qHUceiaA,12274
|
|
5
5
|
aws_bootstrap/gpu.py,sha256=WTnHR0s3mQHDlnzqRgqAC6omWz7nT5YtGpcs0Bf88jk,692
|
|
6
|
-
aws_bootstrap/ssh.py,sha256=
|
|
6
|
+
aws_bootstrap/ssh.py,sha256=UFRDgNR8cljV-lwMvCy_BAJQBz7gj4a_cQIulf-2A10,19226
|
|
7
7
|
aws_bootstrap/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
aws_bootstrap/resources/gpu_benchmark.py,sha256=
|
|
8
|
+
aws_bootstrap/resources/gpu_benchmark.py,sha256=1eFt_3MXvoLhs9HahrRPhbxvtdjFaXG2Ty3GEg7Gud0,29366
|
|
9
9
|
aws_bootstrap/resources/gpu_smoke_test.ipynb,sha256=XvAOEIPa5H9ri5mRZqOdknmwOwKNvCME6DzBGuhRYfg,10698
|
|
10
|
-
aws_bootstrap/resources/
|
|
10
|
+
aws_bootstrap/resources/launch.json,sha256=ZOcvHLy3-zBOqRTtFzuyn-_2tB64yuEn8PrJOoZ-PgE,1484
|
|
11
|
+
aws_bootstrap/resources/remote_setup.sh,sha256=z_YGdzwEHWInkE3dZVbBNa0F_joTeVhnOpCYOj1CK30,8331
|
|
11
12
|
aws_bootstrap/resources/requirements.txt,sha256=gpYl1MFCfWXiAhbIUgAjuTHONz3MKci25msIyOkMmUk,75
|
|
13
|
+
aws_bootstrap/resources/saxpy.cu,sha256=1BSESEwGGCx3KWx9ZJ8jiPHQ42KzQN6i2aP0I28bPsA,1178
|
|
14
|
+
aws_bootstrap/resources/tasks.json,sha256=6U8pB1N8YIWgUCfFet4ne3nYnI92tWv5D5kPiQG3Zlg,1576
|
|
12
15
|
aws_bootstrap/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
aws_bootstrap/tests/test_cli.py,sha256=
|
|
16
|
+
aws_bootstrap/tests/test_cli.py,sha256=Lwzpdovq_iJFB6qZ8NuySqzHFkQ_2Q8AAGXdITXi1Vo,32564
|
|
14
17
|
aws_bootstrap/tests/test_config.py,sha256=arvET6KNl4Vqsz0zFrSdhciXGU688bfsvCr3dSpziN0,1050
|
|
15
18
|
aws_bootstrap/tests/test_ec2.py,sha256=Jmqsjv973hxXbZWfGgECtm6aa2156Lzji227sYMBuMg,10547
|
|
16
19
|
aws_bootstrap/tests/test_gpu.py,sha256=rbMuda_sIVbaCzkWXoLv9YIfnWztgRoP7NuVL8XHrUY,3871
|
|
17
20
|
aws_bootstrap/tests/test_ssh_config.py,sha256=iQDd3hJ8to-2-QHW26Brtglfl0q0P6sCE6U_itxoNyY,11609
|
|
18
21
|
aws_bootstrap/tests/test_ssh_gpu.py,sha256=dRp86Og-8GqiATSff3rxhu83mBZdGgqI4UOnoC00Ln0,1454
|
|
19
|
-
aws_bootstrap_g4dn-0.
|
|
20
|
-
aws_bootstrap_g4dn-0.
|
|
21
|
-
aws_bootstrap_g4dn-0.
|
|
22
|
-
aws_bootstrap_g4dn-0.
|
|
23
|
-
aws_bootstrap_g4dn-0.
|
|
24
|
-
aws_bootstrap_g4dn-0.
|
|
22
|
+
aws_bootstrap_g4dn-0.4.0.dist-info/licenses/LICENSE,sha256=Hen77Mt8sazSQJ9DgrmZuAvDwo2vc5JAkR_avuFV-CM,1067
|
|
23
|
+
aws_bootstrap_g4dn-0.4.0.dist-info/METADATA,sha256=0OQsG5kVwsbfT7dfaZoNrkOlfNRUrKr9NwljtLBKj1I,13483
|
|
24
|
+
aws_bootstrap_g4dn-0.4.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
25
|
+
aws_bootstrap_g4dn-0.4.0.dist-info/entry_points.txt,sha256=T8FXfOgmLEvFi8DHaFJ3tCzId9J3_d2Y6qT98OXxCjA,57
|
|
26
|
+
aws_bootstrap_g4dn-0.4.0.dist-info/top_level.txt,sha256=mix9gZRs8JUv0OMSB_rwdGcRnTKzsKgHrE5fyAn5zJw,14
|
|
27
|
+
aws_bootstrap_g4dn-0.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|