launch.py 557 Bytes
Newer Older
Lengyue's avatar
Lengyue committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import subprocess as sp
import sys

SLURM_NTASKS = 6

processes = []
for i in range(SLURM_NTASKS):
    env = os.environ.copy()
    env["SLURM_PROCID"] = str(i)
    env["SLURM_NTASKS"] = str(SLURM_NTASKS)
    env["CUDA_VISIBLE_DEVICES"] = str(i % 8)

    processes.append(
        sp.Popen(
            f"python preparing_data/wenet_clean/clean_wenet_speech.py",
            shell=True,
            env=env,
            stdout=sys.stdout,
            stderr=sys.stderr,
        )
    )


for p in processes:
    p.wait()
    print(p.communicate())