[BUG]: cuda error: OOM docker(hpcaitech/cuda-conda:11.3) test example/language/gpt run bash run_gemini.sh on single gpu
π Describe the bug
[BUG]: cuda error: OOM docker(hpcaitech/cuda-conda:11.3) test example/language/gpt run bash run_gemini.sh on single gpu
trace log: root@2a72e3584d6d:/workspace/ColossalAI/examples/language/gpt/gemini# bash run_gemini.sh
- export DISTPLAN=CAI_Gemini
- DISTPLAN=CAI_Gemini
- export GPUNUM=1
- GPUNUM=1
- export TPDEGREE=1
- TPDEGREE=1
- export PLACEMENT=auto
- PLACEMENT=auto
- export USE_SHARD_INIT=False
- USE_SHARD_INIT=False
- export BATCH_SIZE=2
- BATCH_SIZE=2
- export MODEL_TYPE=gpt2_medium
- MODEL_TYPE=gpt2_medium
- export TRAIN_STEP=2
- TRAIN_STEP=2
- '[' False = True ']'
- USE_SHARD_INIT=
- mkdir -p gemini_logs
- torchrun --standalone --nproc_per_node=1 ./train_gpt_demo.py --tp_degree=1 --model_type=gpt2_medium --batch_size=2 --placement=auto --distplan=CAI_Gemini --train_step=2
- tee ./gemini_logs/gpt2_medium_CAI_Gemini_gpu_1_bs_2_tp_1_auto.log
environmental variable OMP_NUM_THREADS is set to 8.
[03/31/23 08:51:40] INFO colossalai - colossalai - INFO: /opt/conda/lib/python3.10/site-packages/colossalai/context/parallel_context.py:522
set_device
INFO colossalai - colossalai - INFO: process rank 0 is bound to device 0
[03/31/23 08:51:41] INFO colossalai - colossalai - INFO: /opt/conda/lib/python3.10/site-packages/colossalai/context/parallel_context.py:558
set_seed
INFO colossalai - colossalai - INFO: initialized seed on rank 0, numpy: 1024, python random: 1024, ParallelMode.DATA: 1024,
ParallelMode.TENSOR: 1024,the default parallel seed is ParallelMode.DATA.
INFO colossalai - colossalai - INFO: /opt/conda/lib/python3.10/site-packages/colossalai/initialize.py:116 launch
INFO colossalai - colossalai - INFO: Distributed environment is initialized, data parallel size: 1, pipeline parallel size: 1, tensor parallel size: 1
INFO colossalai - colossalai - INFO: /workspace/ColossalAI/examples/language/gpt/gemini/./train_gpt_demo.py:211 main
INFO colossalai - colossalai - INFO: gpt2_medium, CAI_Gemini, batch size 2
[extension] OP colossalai._C.cpu_adam has been compileed ahead of time, skip building. [extension] OP colossalai._C.fused_optim has been compileed ahead of time, skip building. searching chunk configuration is completed in 1.93 s. used number: 338.39 MB, wasted number: 1.00 MB total wasted percentage is 0.29% Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/colossalai/gemini/chunk/manager.py", line 63, in register_tensor chunk_group[-1].append_tensor(tensor) File "/opt/conda/lib/python3.10/site-packages/colossalai/gemini/chunk/chunk.py", line 264, in append_tensor raise ChunkFullError colossalai.gemini.chunk.chunk.ChunkFullError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workspace/ColossalAI/examples/language/gpt/gemini/./train_gpt_demo.py", line 353, in
main()
File "/workspace/ColossalAI/examples/language/gpt/gemini/./train_gpt_demo.py", line 267, in main
model = zero_model_wrapper(model, zero_stage, gemini_config)
File "/opt/conda/lib/python3.10/site-packages/colossalai/nn/parallel/zero_wrapper.py", line 43, in zero_model_wrapper
wrapped_model = GeminiDDP(model, **gemini_config)
File "/opt/conda/lib/python3.10/site-packages/colossalai/nn/parallel/gemini_parallel.py", line 63, in init
super().init(module, gemini_manager, pin_memory, force_outputs_fp32, strict_ddp_mode)
File "/opt/conda/lib/python3.10/site-packages/colossalai/nn/parallel/data_parallel.py", line 242, in init
self._init_chunks(param_order=param_order,
File "/opt/conda/lib/python3.10/site-packages/colossalai/nn/parallel/data_parallel.py", line 670, in _init_chunks
self.chunk_manager.register_tensor(tensor=fp32_p,
File "/opt/conda/lib/python3.10/site-packages/colossalai/gemini/chunk/manager.py", line 71, in register_tensor
self.__close_one_chunk(chunk_group[-1])
File "/opt/conda/lib/python3.10/site-packages/colossalai/gemini/chunk/manager.py", line 231, in __close_one_chunk
chunk.close_chunk()
File "/opt/conda/lib/python3.10/site-packages/colossalai/gemini/chunk/chunk.py", line 302, in close_chunk
self.cpu_shard = torch.empty(self.shard_size, dtype=self.dtype, pin_memory=self.pin_memory)
RuntimeError: CUDA error: out of memory
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 525) of binary: /opt/conda/bin/python
Traceback (most recent call last):
File "/opt/conda/bin/torchrun", line 33, in
sys.exit(load_entry_point('torch==1.12.1', 'console_scripts', 'torchrun')())
File "/opt/conda/lib/python3.10/site-packages/torch/distributed/elastic/multiprocessing/errors/init.py", line 345, in wrapper
return f(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/distributed/run.py", line 761, in main
run(args)
File "/opt/conda/lib/python3.10/site-packages/torch/distributed/run.py", line 752, in run
elastic_launch(
File "/opt/conda/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 131, in call
return launch_agent(self._config, self._entrypoint, list(args))
File "/opt/conda/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
./train_gpt_demo.py FAILED
Failures: <NO_OTHER_FAILURES>
Root Cause (first observed failure): [0]: time : 2023-03-31_08:51:49 host : 2a72e3584d6d rank : 0 (local_rank: 0) exitcode : 1 (pid: 525) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
Environment
root@2a72e3584d6d:/workspace/ColossalAI/examples/language/gpt/gemini# nvidia-smi
Fri Mar 31 08:59:14 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.41.03 Driver Version: 531.41 CUDA Version: 12.1 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce GTX 1060 6GB On | 00000000:01:00.0 Off | N/A |
| 41% 34C P8 5W / 120W| 398MiB / 6144MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+
system env:
NV_LIBCUBLAS_VERSION=11.5.1.109-1 NVIDIA_VISIBLE_DEVICES=all NV_NVML_DEV_VERSION=11.3.58-1 NV_CUDNN_PACKAGE_NAME=libcudnn8 NV_LIBNCCL_DEV_PACKAGE=libnccl-dev=2.9.9-1+cuda11.3 NV_LIBNCCL_DEV_PACKAGE_VERSION=2.9.9-1 HOSTNAME=2a72e3584d6d NVIDIA_REQUIRE_CUDA=cuda>=11.3 brand=tesla,driver>=418,driver<419 brand=tesla,driver>=440,driver<441 driver>=450 NV_LIBCUBLAS_DEV_PACKAGE=libcublas-dev-11-3=11.5.1.109-1 NV_NVTX_VERSION=11.3.109-1 NV_ML_REPO_ENABLED=1 NV_CUDA_CUDART_DEV_VERSION=11.3.109-1 NV_LIBCUSPARSE_VERSION=11.6.0.109-1 NV_LIBNPP_VERSION=11.3.3.95-1 NCCL_VERSION=2.9.9-1 PWD=/workspace/ColossalAI/examples/language/gpt/gemini NV_CUDNN_PACKAGE=libcudnn8=8.2.0.53-1+cuda11.3 NVIDIA_DRIVER_CAPABILITIES=compute,utility NV_LIBNPP_PACKAGE=libnpp-11-3=11.3.3.95-1 NV_LIBNCCL_DEV_PACKAGE_NAME=libnccl-dev NV_LIBCUBLAS_DEV_VERSION=11.5.1.109-1 NV_LIBCUBLAS_DEV_PACKAGE_NAME=libcublas-dev-11-3 TRAIN_STEP=2 NV_CUDA_CUDART_VERSION=11.3.109-1 HOME=/root CUDA_VERSION=11.3.1 NV_LIBCUBLAS_PACKAGE=libcublas-11-3=11.5.1.109-1 PLACEMENT=auto NV_LIBNPP_DEV_PACKAGE=libnpp-dev-11-3=11.3.3.95-1 NV_LIBCUBLAS_PACKAGE_NAME=libcublas-11-3 NV_LIBNPP_DEV_VERSION=11.3.3.95-1 LESSCLOSE=/usr/bin/lesspipe %s %s TERM=xterm NV_LIBCUSPARSE_DEV_VERSION=11.6.0.109-1 NV_ML_REPO_URL=https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 LESSOPEN=| /usr/bin/lesspipe %s LIBRARY_PATH=/usr/local/cuda/lib64/stubs NV_CUDNN_VERSION=8.2.0.53 SHLVL=1 NV_CUDA_LIB_VERSION=11.3.1-1 NVARCH=x86_64 NV_CUDNN_PACKAGE_DEV=libcudnn8-dev=8.2.0.53-1+cuda11.3 BATCH_SIZE=2 NV_CUDA_COMPAT_PACKAGE=cuda-compat-11-3 NV_LIBNCCL_PACKAGE=libnccl2=2.9.9-1+cuda11.3 LD_LIBRARY_PATH=/root/.tensornvme/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 CUDA_HOME=/usr/local/cuda PATH=/opt/conda/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin NV_LIBNCCL_PACKAGE_NAME=libnccl2 NV_LIBNCCL_PACKAGE_VERSION=2.9.9-1 OLDPWD=/workspace/ColossalAI/examples/language/gpt _=/usr/bin/env
Unfortunately, your single GPU with about 6GB is not enough to support gpt-medium model training. You may try smaller models or enlarge your main memory.
Bot detected the issue body's language is not English, translate it automatically. π―ππ»π§βπ€βπ§π«π§πΏβπ€βπ§π»π©πΎβπ€βπ¨πΏπ¬πΏ
Unfortunately, your single GPU with about 6GB cannot not support gpt-medium model training.
Unfortunately, your single GPU with about 6GB is not enough to support gpt-medium model training. You may try smaller models or enlarge your main memory.
What is the minimum required to run gpt-medium? Gpt-medium is the smallest model in gpt, right?
Hi, thanks for reporting this, and sorry it went unanswered for so long. We're going through older issues and closing the ones that no longer apply to the current codebase. The code this issue refers to (colossalai/context/parallel_context.py, colossalai/gemini/chunk/chunk.py) has since been refactored or moved to colossalai/legacy, so the problem as described no longer applies to the current main branch. We're marking it as stale and will close it in 14 days. If you still see this problem with the latest ColossalAI on PyTorch 2.x, please comment here (or open a new issue) with your environment and a minimal reproduction, and we'll take a look.
Closing this issue since there has been no response in the 14 days after it was marked as stale. If you still run into this problem with the latest ColossalAI on PyTorch 2.x, please open a new issue using the bug report template, with your environment and a minimal reproduction.