Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,9 @@ jobs:
CXX: g++-${{ matrix.gcc }}
TENSORFLOW_VERSION: ${{ matrix.tf }}
- run: dp --version
- name: Prepare parallel runtime
if: ${{ matrix.tf == '' }}
run: |
sudo apt install libopenmpi-dev openmpi-bin
HOROVOD_WITHOUT_GLOO=1 HOROVOD_WITH_TENSORFLOW=1 pip install horovod mpi4py
- run: pytest --cov=deepmd source/tests && codecov
1 change: 0 additions & 1 deletion deepmd/train/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ def _init_session(self):
config = get_tf_session_config()
device, idx = self.run_opt.my_device.split(":", 1)
if device == "gpu":
config.gpu_options.allow_growth = True
config.gpu_options.visible_device_list = idx
self.sess = tf.Session(config=config)

Expand Down
7 changes: 5 additions & 2 deletions source/tests/test_parallel_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ def setUp(self):
def test_two_workers(self):
command = 'horovodrun -np 2 dp train -m workers ' + self.input_file
penv = os.environ.copy()
if len(get_gpus() or []) > 1:
num_gpus = len(get_gpus() or [])
if num_gpus > 1:
penv['CUDA_VISIBLE_DEVICES'] = '0,1'
popen = sp.Popen(command, shell=True, env=penv, stdout=sp.PIPE, stderr=sp.STDOUT)
elif num_gpus == 1:
raise unittest.SkipTest("At least 2 GPU cards are needed for parallel-training tests.")
popen = sp.Popen(command, shell=True, cwd=str(tests_path), env=penv, stdout=sp.PIPE, stderr=sp.STDOUT)
for line in iter(popen.stdout.readline, b''):
if hasattr(line, 'decode'):
line = line.decode('utf-8')
Expand Down