acoustic-van-30942
04/19/2023, 3:52 PMvictorious-lawyer-58417
04/19/2023, 4:12 PM@gpu_profile to your GPU steps and you'll see cards like this:victorious-lawyer-58417
04/19/2023, 4:13 PMnvidia-smi to measure utilization so you need that in the image, but that's usually installed by default in all CUDA-enabled images anyways)acoustic-van-30942
04/19/2023, 4:23 PMvictorious-lawyer-58417
04/19/2023, 4:24 PMacoustic-van-30942
04/19/2023, 4:26 PMvictorious-lawyer-58417
04/19/2023, 4:29 PMacoustic-van-30942
04/19/2023, 4:30 PMfresh-laptop-72652
04/19/2023, 7:01 PM@card decorator on the step
• needs to be @gpu_profile() rather than @gpu_profile even when using defaultsvictorious-lawyer-58417
04/19/2023, 7:40 PMvictorious-lawyer-58417
04/19/2023, 7:40 PMacoustic-van-30942
04/20/2023, 6:18 AMKey axes.edgecolor: #666 does not look like a color argvictorious-lawyer-58417
04/20/2023, 6:42 AMmatplotlib version.victorious-lawyer-58417
04/20/2023, 6:43 AM"matplotlib": "3.7.0" should workvictorious-lawyer-58417
04/20/2023, 6:44 AMacoustic-van-30942
04/20/2023, 3:10 PMmatplotlib: 3.5.3 , and works like a charm now.acoustic-van-30942
04/21/2023, 5:36 AMMONITOR = """
set -e;
while kill -0 {pid} 2>/dev/null;
do
gpu=$(nvidia-smi \
--query-gpu=pci.bus_id,timestamp,utilization.gpu,memory.used,memory.total \
--format=csv,noheader,nounits | sed 's/,/, /g');
cpu=$(top -n 1 -b | grep "Cpu(s)" | awk '{{printf("%.1f", $2+$4)}}');
ram=$(free -m | awk 'NR==2{{printf("%d, %d", $3, $2)}}');
echo "$gpu, $cpu, $ram";
sleep {interval};
done
""".replace(
"\n", " "
)
I'm trying to understand why Sagemaker Training is on average 1.5 minutes faster than AWS Batch at completing 1 epoch for one of our customer's models. Using your decorator, I generated the below graphs - (first two are AWS Batch, the last one is Sagemaker Training)
Looks like CPU utilization for Sagemaker Training is a lot more steady than AWS Batch. Also looks like GPU utilization on AWS Batch oscillates a lot more than Sagemaker Training and dips to zero quite often. Any thoughts on this? Could this be what's causing the slight uptick in execution time for AWS Batch training jobs vs. Sagemaker Training?victorious-lawyer-58417
04/21/2023, 5:38 AMvictorious-lawyer-58417
04/21/2023, 5:39 AMacoustic-van-30942
04/21/2023, 3:23 PMp2.xlarge and Sagemaker is using ml.p2.xlarge.victorious-lawyer-58417
04/21/2023, 3:38 PMacoustic-van-30942
04/21/2023, 3:42 PMstart -> train -> end. The only thing that the Metaflow flow is doing that Sagemaker isn't doing is redirecting tqdm to logs. But that's it I believe.victorious-lawyer-58417
04/21/2023, 3:52 PMflow.py run locally on an ec2 instance)
if it still behaves erratically (unlikely), it could be something in the code. If it behaves fine, it’s something about your batch setupvictorious-lawyer-58417
04/21/2023, 3:54 PMacoustic-van-30942
04/21/2023, 3:56 PMvictorious-lawyer-58417
04/21/2023, 3:58 PMfresh-laptop-72652
04/21/2023, 6:31 PMp2 instance nowadays. Those nvidia K80s came out in 2014 and are a really bad price/performance value. Compared to something like the g5 instances (the "value" oriented modern GPU instances) that use nvidia A10Gs, and cost effectively the same amount.
Comparing p2.xl (K80) vs g5.xl (A10G):
• K80 can't go beyond CUDA 10 (many new optimizations for transformers require CUDA 11+)
• A10G has 24GB VRAM compared to 12GB, at 2x the speed (600GB/s GDDR6 vs 288GB/s GDDR5)
• A10G has 4x number of tensor cores compared to the K80's older CUDA cores, making the A10G have ~16x higher Tflops in raw fp32 compute performance
• If you care about power, the A10G does all that with ~40% less consumption
• g5 has 10Gb/s networking compared to 1Gb/s
• g5 has 20% faster CPU clock
on-demand g5.xl is $1/hr, compared to ml.p2xl at $1.1/hr, so you'll spend less money to get significantly more performance 😛
The A10Gs are even within striking distance to the p3's V100 GPUs in terms of raw performance, and win by a large margin in terms of price/performance there too.
Lastly, there's way more spot availability of A10Gs if you're able to take advantage of that. We have some chonky pipelines that can spin up spot clusters of 100s of those A10G GPUs and it's wild how much bang for your buck you can get out of them 🚀victorious-lawyer-58417
04/21/2023, 6:34 PMg5 are pretty much the sweet spot currently in AWS (unless you need tons of VRAM)victorious-lawyer-58417
04/21/2023, 6:36 PMp instances come in handy if you need to do distributed training across GPUs, thanks to NVLinkfresh-laptop-72652
04/21/2023, 6:37 PMg5.48xl with 8 A10Gs?!?!victorious-lawyer-58417
04/21/2023, 6:38 PMvictorious-lawyer-58417
04/21/2023, 6:39 PMfresh-laptop-72652
04/21/2023, 6:42 PMvictorious-lawyer-58417
04/21/2023, 6:43 PMfresh-laptop-72652
04/21/2023, 6:44 PMvictorious-lawyer-58417
04/21/2023, 6:45 PMvictorious-lawyer-58417
04/21/2023, 6:45 PMvictorious-lawyer-58417
04/21/2023, 6:45 PMp4 currently 😛fresh-laptop-72652
04/21/2023, 6:46 PMfresh-laptop-72652
04/21/2023, 6:53 PMvictorious-lawyer-58417
04/21/2023, 7:09 PMacoustic-van-30942
04/24/2023, 6:43 AM