A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/StanfordVL/MinkowskiEngine/commit/be5c3c18b26d6a62380d613533b7a939a5458705 below:

fix CPU only build with memman · NVIDIA/MinkowskiEngine@be5c3c1 · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+24

-18

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+24

-18

lines changed Original file line number Diff line number Diff line change

@@ -1,6 +1,6 @@

1 1

# Change Log

2 2 3 -

## [master] - 2020-05-07

3 +

## [master] - 2020-05-19

4 4 5 5

### Changed

6 6 Original file line number Diff line number Diff line change

@@ -49,7 +49,7 @@ We visualized a sparse tensor network operation on a sparse tensor, convolution,

49 49 50 50

- Ubuntu 14.04 or higher

51 51

- CUDA 10.1 or higher

52 -

- pytorch 1.3 or higher

52 +

- pytorch 1.5 or higher

53 53

- python 3.6 or higher

54 54

- GCC 7 or higher

55 55 Original file line number Diff line number Diff line change

@@ -131,7 +131,9 @@ def _argparse(pattern, argv, is_flag=True):

131 131 132 132

# extra_compile_args+=['-g'] # Uncomment for debugging

133 133

if CPU_ONLY and not FORCE_CUDA:

134 -

print("\nCPU_ONLY build set")

134 +

print("--------------------------------")

135 +

print("| WARNING: CPU_ONLY build set |")

136 +

print("--------------------------------")

135 137

compile_args += ["CPU_ONLY=1"]

136 138

extra_compile_args += ["-DCPU_ONLY"]

137 139

Extension = CppExtension

Original file line number Diff line number Diff line change

@@ -122,18 +122,18 @@ template <typename MapType = CoordsToIndexMap> class CoordsManager {

122 122

unordered_map<InOutMapKey, InOutMaps<int>, InOutMapKeyHash> in_maps;

123 123

unordered_map<InOutMapKey, InOutMaps<int>, InOutMapKeyHash> out_maps;

124 124 125 -

CoordsManager(){

126 -

gpu_memory_manager = std::make_shared<GPUMemoryManager>();

127 -

};

128 -

CoordsManager(int num_threads) {

129 -

omp_set_dynamic(0);

130 -

omp_set_num_threads(num_threads);

131 -

}

132 125

CoordsManager(int num_threads, MemoryManagerBackend backend) {

133 -

omp_set_dynamic(0);

134 -

omp_set_num_threads(num_threads);

126 +

if (num_threads > 0) {

127 +

omp_set_dynamic(0);

128 +

omp_set_num_threads(num_threads);

129 +

}

130 +

#ifndef CPU_ONLY

135 131

gpu_memory_manager = std::make_shared<GPUMemoryManager>(backend);

132 +

#endif

136 133

}

134 +

CoordsManager(int num_threads): CoordsManager(num_threads, PYTORCH) {}

135 +

CoordsManager(): CoordsManager(-1, PYTORCH) {}

136 + 137 137

~CoordsManager() { clear(); }

138 138 139 139

void printDiagnostics(py::object py_coords_key) const;

Original file line number Diff line number Diff line change

@@ -41,8 +41,6 @@ namespace minkowski {

41 41 42 42

using std::vector;

43 43 44 -

enum MemoryManagerBackend { CUDA = 0, PYTORCH = 1 };

45 - 46 44

class GPUMemoryManager {

47 45

private:

48 46

int initial_size = 256;

Original file line number Diff line number Diff line change

@@ -97,6 +97,9 @@ using InOutMapsRefPair = pair<InOutMaps<Itype> &, InOutMaps<Itype> &>;

97 97

template <typename Itype>

98 98

using pInOutMapsRefPair = pair<pInOutMaps<Itype> &, pInOutMaps<Itype> &>;

99 99 100 +

// GPU memory manager backend. No effect with CPU_ONLY build

101 +

enum MemoryManagerBackend { CUDA = 0, PYTORCH = 1 };

102 + 100 103

// FNV64-1a

101 104

// uint64_t for unsigned long, must use CXX -m64

102 105

template <typename T> uint64_t hash_vec(T p) {

Original file line number Diff line number Diff line change

@@ -169,11 +169,14 @@ def test_batch_size_initialize(self):

169 169

self.assertTrue(cm.get_batch_size() == 2)

170 170 171 171

def test_memory_manager_backend(self):

172 -

CoordsManager(memory_manager_backend=MemoryManagerBackend.CUDA, D=2)

173 -

CoordsManager(memory_manager_backend=MemoryManagerBackend.PYTORCH, D=2)

174 - 172 +

# Set the global GPU memory manager backend. By default PYTORCH.

175 173

ME.set_memory_manager_backend(MemoryManagerBackend.PYTORCH)

176 -

CoordsManager(D=2)

174 +

ME.set_memory_manager_backend(MemoryManagerBackend.CUDA)

175 + 176 +

# Create a coords man with the specified GPU memory manager backend.

177 +

# No effect with CPU_ONLY build

178 +

cm = CoordsManager(memory_manager_backend=MemoryManagerBackend.CUDA, D=2)

179 +

cm = CoordsManager(memory_manager_backend=MemoryManagerBackend.PYTORCH, D=2)

177 180 178 181 179 182

if __name__ == '__main__':

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4