MCPcopy
hub / github.com/deepspeedai/DeepSpeed / GDSBuilder

Class GDSBuilder

op_builder/gds.py:10–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class GDSBuilder(AsyncIOBuilder):
11 BUILD_VAR = "DS_BUILD_GDS"
12 NAME = "gds"
13
14 def __init__(self):
15 super().__init__()
16
17 def absolute_name(self):
18 return f'deepspeed.ops.gds.{self.NAME}_op'
19
20 def lib_sources(self):
21 src_list = ['csrc/gds/py_lib/deepspeed_py_gds_handle.cpp', 'csrc/gds/py_lib/deepspeed_gds_op.cpp']
22 return super().lib_sources() + src_list
23
24 def sources(self):
25 return self.lib_sources() + ['csrc/gds/py_lib/py_ds_gds.cpp']
26
27 def cxx_args(self):
28 return super().cxx_args() + ['-lcufile']
29
30 def include_paths(self):
31 import torch
32 CUDA_INCLUDE = [os.path.join(torch.utils.cpp_extension.CUDA_HOME, "include")]
33 return ['csrc/aio/py_lib', 'csrc/aio/common'] + CUDA_INCLUDE
34
35 def extra_ldflags(self):
36 return super().extra_ldflags() + ['-lcufile']
37
38 def is_compatible(self, verbose=False):
39 if self.is_rocm_pytorch():
40 if verbose:
41 self.warning(f'{self.NAME} is not compatible with ROCM')
42 return False
43
44 try:
45 import torch.utils.cpp_extension
46 except ImportError:
47 if verbose:
48 self.warning("Please install torch if trying to pre-compile GDS")
49 return False
50
51 CUDA_HOME = torch.utils.cpp_extension.CUDA_HOME
52 if CUDA_HOME is None:
53 if verbose:
54 self.warning("Please install torch CUDA if trying to pre-compile GDS with CUDA")
55 return False
56
57 CUDA_LIB64 = os.path.join(CUDA_HOME, "lib64")
58 gds_compatible = self.has_function(funcname="cuFileDriverOpen",
59 libraries=("cufile", ),
60 library_dirs=(
61 CUDA_HOME,
62 CUDA_LIB64,
63 ),
64 verbose=verbose)
65
66 return gds_compatible and super().is_compatible(verbose)

Callers 14

test_parallel_readMethod · 0.90
test_async_readMethod · 0.90
test_parallel_writeMethod · 0.90
test_async_writeMethod · 0.90
test_readMethod · 0.90
test_writeMethod · 0.90
test_offset_writeMethod · 0.90
test_offset_readMethod · 0.90
gds_io_setupFunction · 0.90
_create_contextMethod · 0.90
_configure_aioMethod · 0.90

Calls

no outgoing calls

Tested by 9

test_parallel_readMethod · 0.72
test_async_readMethod · 0.72
test_parallel_writeMethod · 0.72
test_async_writeMethod · 0.72
test_readMethod · 0.72
test_writeMethod · 0.72
test_offset_writeMethod · 0.72
test_offset_readMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…