MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / configure_module

Function configure_module

yolox/utils/setup_env.py:25–51  ·  view source on GitHub ↗

Configure pytorch module environment. setting of ulimit and cv2 will be set. Args: ulimit_value(int): default open file number on linux. Default value: 8192.

(ulimit_value=8192)

Source from the content-addressed store, hash-verified

23
24
25def configure_module(ulimit_value=8192):
26 """
27 Configure pytorch module environment. setting of ulimit and cv2 will be set.
28
29 Args:
30 ulimit_value(int): default open file number on linux. Default value: 8192.
31 """
32 # system setting
33 try:
34 import resource
35
36 rlimit = resource.getrlimit(resource.RLIMIT_NOFILE)
37 resource.setrlimit(resource.RLIMIT_NOFILE, (ulimit_value, rlimit[1]))
38 except Exception:
39 # Exception might be raised in Windows OS or rlimit reaches max limit number.
40 # However, set rlimit value might not be necessary.
41 pass
42
43 # cv2
44 # multiprocess might be harmful on performance of torch dataloader
45 os.environ["OPENCV_OPENCL_RUNTIME"] = "disabled"
46 try:
47 cv2.setNumThreads(0)
48 cv2.ocl.setUseOpenCL(False)
49 except Exception:
50 # cv2 version mismatch might rasie exceptions.
51 pass

Callers 1

__init__.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected