Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions scripts/cpu-gpu-monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

mkdir data
cd data

# apt-get install moreutils
# needed for ts

while true
do
top -n 1 -o +%CPU -b | grep cascade_server | sed -e 's/\s\+/,/g' | ts %s >> cpu_utilization.dat
{ date +%s | sed -z 's/\n/, /g'; nvidia-smi --query-gpu=utilization.gpu,utilization.memory,memory.total,memory.free,memory.used --format=csv,noheader; } >> gpu_utilization.dat
nvidia-smi --query-compute-apps=process_name,pid,used_memory --format=csv,noheader | ts %s"," >> gpu_by_process.dat
sleep 3
done
26 changes: 26 additions & 0 deletions scripts/gpu_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from numba import jit, cuda
import numpy as np
# to measure exec time
from timeit import default_timer as timer

@cuda.jit
def func(a):
# Thread id in a 1D block
tx = cuda.threadIdx.x
# Block id in a 1D grid
ty = cuda.blockIdx.x
# Block width, i.e. number of threads per block
bw = cuda.blockDim.x
# Compute flattened index inside the array
pos = tx + ty * bw
if pos < 10000000:
a[pos] += 1

if __name__=="__main__":
n = 10000000
a = np.ones(n, dtype = np.float64)

threadsperblock = 10
blockspergrid = (n + (threadsperblock - 1))
for i in range(10000000):
func[blockspergrid, threadsperblock](a)