File size: 1,543 Bytes
5024339
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
34
35
36
"""Resume the full PanoData test split on physical GPU 3; retain run status."""
from pathlib import Path
import fcntl
import json
import os
import subprocess
import sys
import time

root=Path(__file__).resolve().parents[1]
logs=root/'logs'
lock=(logs/'panodata_all.lock').open('w')
fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
status_path=logs/'panodata_all_status.json'
metadata=Path('/home/zhangzhilu/shared/datasets/Pano-World/PanoData-v4/test.txt')
count=sum(bool(line.strip()) for line in metadata.read_text().splitlines())
env=os.environ.copy()
env['CUDA_VISIBLE_DEVICES']='3'
env.setdefault('OMP_NUM_THREADS','8')
env.setdefault('PYTORCH_CUDA_ALLOC_CONF','expandable_segments:True')
command=[sys.executable,'-u','scripts/infer_panodata.py','--max_samples',str(count),
         '--perspective_num_frames','1','--num_frames','81','--skip_existing','--device','cuda:0']
def save(state,**extra):
 payload={'state':state,'gpu':3,'total_samples':count,'command':command,
          'updated_at':time.strftime('%Y-%m-%d %H:%M:%S %z'),**extra}
 temporary=status_path.with_suffix('.tmp')
 temporary.write_text(json.dumps(payload,indent=2));temporary.replace(status_path)
 print(json.dumps(payload),flush=True)
with (logs/'infer_panodata_all.log').open('ab',buffering=0) as log:
 child=subprocess.Popen(command,cwd=root,env=env,stdin=subprocess.DEVNULL,
                        stdout=log,stderr=subprocess.STDOUT)
 save('running',pid=child.pid)
 code=child.wait()
save('complete' if code==0 else 'failed',returncode=code)
raise SystemExit(code)