profile_2nd_run.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
  2. GPUS_PER_NODE=8 # <--- remember to change the number of GPUs you actually have in your system
  3. # Change for multinode config
  4. MASTER_ADDR=localhost
  5. MASTER_PORT=6000
  6. NNODES=1 #<-- currently we are using 1 node multigpus
  7. NODE_RANK=0
  8. WORLD_SIZE=8 # <--- remember to change the number of GPUs you actually have in your system
  9. TENSOR_MP_SIZE=8
  10. PIPELINE_MP_SIZE=1
  11. ### modify this section to point the file to its own path
  12. CHECKPOINT_PATH='./Megatron-LM/sv_ckpt/'
  13. DATA_PATH='../dataset/EN/NVblogs_text_document'
  14. VOCAB_FILE='../dataset/EN/50k/gpt2-vocab.json'
  15. MERGE_FILE='../dataset/EN/50k/gpt2-merges.txt'
  16. PROFILE_OUTPUT_PATH='/home/zcharpy/profiles/DLprof/2ndrun/nsys_improved' # modify this to your own profile path
  17. export OMP_NUM_THREADS=1
  18. DISTRIBUTED_ARGS="--nproc_per_node $GPUS_PER_NODE --nnodes $NNODES --node_rank $NODE_RANK --master_addr $MASTER_ADDR --master_port $MASTER_PORT"
  19. ## for nsys run
  20. nsys profile --stats=false --force-overwrite=true --duration=300 --trace=cudnn,cuda,osrt,nvtx -o $PROFILE_OUTPUT_PATH \
  21. python -m torch.distributed.launch $DISTRIBUTED_ARGS \
  22. ./Megatron-LM/Dlprof_pretrain_gpt.py \
  23. --tensor-model-parallel-size $TENSOR_MP_SIZE \
  24. --pipeline-model-parallel-size $PIPELINE_MP_SIZE \
  25. --num-layers 32 \
  26. --hidden-size 1024 \
  27. --num-attention-heads 32 \
  28. --micro-batch-size 64 \
  29. --global-batch-size 512 \
  30. --seq-length 512 \
  31. --max-position-embeddings 512 \
  32. --train-samples 100 \
  33. --save $CHECKPOINT_PATH \
  34. --load $CHECKPOINT_PATH \
  35. --data-path $DATA_PATH \
  36. --vocab-file $VOCAB_FILE \
  37. --merge-file $MERGE_FILE \
  38. --data-impl mmap \
  39. --split 949,50,1 \
  40. --distributed-backend nccl \
  41. --lr 0.00015 \
  42. --lr-decay-style cosine \
  43. --min-lr 1.0e-5 \
  44. --weight-decay 1e-2 \
  45. --clip-grad 1.0 \
  46. --lr-warmup-fraction .01 \
  47. --checkpoint-activations \
  48. --log-interval 10 \
  49. --save-interval 100 \
  50. --eval-interval 200 \
  51. --eval-iters 10 \
  52. --fp16