torch-linear-assignment 0.0.1.post3__tar.gz → 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {torch_linear_assignment-0.0.1.post3/torch_linear_assignment.egg-info → torch_linear_assignment-0.0.2}/PKG-INFO +1 -1
  2. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/setup.py +1 -1
  3. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/src/torch_linear_assignment_cuda_kernel.cu +11 -7
  4. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2/torch_linear_assignment.egg-info}/PKG-INFO +1 -1
  5. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/LICENSE +0 -0
  6. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/MANIFEST.in +0 -0
  7. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/README.md +0 -0
  8. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/pyproject.toml +0 -0
  9. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/requirements.txt +0 -0
  10. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/setup.cfg +0 -0
  11. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/src/torch_linear_assignment.cpp +0 -0
  12. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/src/torch_linear_assignment_cuda.cpp +0 -0
  13. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/torch_linear_assignment/__init__.py +0 -0
  14. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/torch_linear_assignment/assignment.py +0 -0
  15. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/torch_linear_assignment.egg-info/SOURCES.txt +0 -0
  16. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/torch_linear_assignment.egg-info/dependency_links.txt +0 -0
  17. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/torch_linear_assignment.egg-info/requires.txt +0 -0
  18. {torch_linear_assignment-0.0.1.post3 → torch_linear_assignment-0.0.2}/torch_linear_assignment.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: torch-linear-assignment
3
- Version: 0.0.1.post3
3
+ Version: 0.0.2
4
4
  Summary: Batched linear assignment with PyTorch and CUDA.
5
5
  Author: Ivan Karpukhin
6
6
  Author-email: karpuhini@yandex.ru
@@ -48,7 +48,7 @@ with open("README.md") as fp:
48
48
  if __name__ == '__main__':
49
49
  setuptools.setup(
50
50
  name="torch-linear-assignment",
51
- version="0.0.1.post3",
51
+ version="0.0.2",
52
52
  author="Ivan Karpukhin",
53
53
  author_email="karpuhini@yandex.ru",
54
54
  description="Batched linear assignment with PyTorch and CUDA.",
@@ -21,10 +21,10 @@
21
21
  typedef unsigned char uint8_t;
22
22
 
23
23
 
24
- int SMPCores()
24
+ int SMPCores(int device_index)
25
25
  {
26
26
  cudaDeviceProp devProp;
27
- cudaGetDeviceProperties(&devProp, 0);
27
+ cudaGetDeviceProperties(&devProp, device_index);
28
28
  switch (devProp.major){
29
29
  case 2: // Fermi
30
30
  if (devProp.minor == 1)
@@ -204,8 +204,11 @@ void solve_cuda_kernel_batch(int bs, int nr, int nc,
204
204
 
205
205
 
206
206
  template <typename scalar_t>
207
- void solve_cuda_batch(int bs, int nr, int nc,
207
+ void solve_cuda_batch(int device_index,
208
+ int bs, int nr, int nc,
208
209
  scalar_t *cost, int *col4row, int *row4col) {
210
+ cudaSetDevice(device_index);
211
+
209
212
  TORCH_CHECK(std::numeric_limits<scalar_t>::has_infinity, "Data type doesn't have infinity.");
210
213
  auto infinity = std::numeric_limits<scalar_t>::infinity();
211
214
 
@@ -221,9 +224,9 @@ void solve_cuda_batch(int bs, int nr, int nc,
221
224
  thrust::fill(v.begin(), v.end(), (scalar_t) 0);
222
225
  thrust::fill(path.begin(), path.end(), -1);
223
226
 
224
- int blockSize = SMPCores();
227
+ int blockSize = SMPCores(device_index);
225
228
  int gridSize = (bs + blockSize - 1) / blockSize;
226
- at::cuda::CUDAStream stream = at::cuda::getCurrentCUDAStream();
229
+ at::cuda::CUDAStream stream = at::cuda::getCurrentCUDAStream(device_index);
227
230
  solve_cuda_kernel_batch<<<gridSize, blockSize, 0, stream.stream()>>>(
228
231
  bs, nr, nc,
229
232
  cost,
@@ -260,12 +263,13 @@ std::vector<torch::Tensor> batch_linear_assignment_cuda(torch::Tensor cost) {
260
263
  return {col4row, row4col};
261
264
  }
262
265
 
263
- AT_DISPATCH_FLOATING_TYPES(cost.type(), "solve_cuda_batch", ([&] {
266
+ AT_DISPATCH_FLOATING_TYPES(cost.scalar_type(), "solve_cuda_batch", [&] {
264
267
  solve_cuda_batch<scalar_t>(
268
+ device.index(),
265
269
  sizes[0], sizes[1], sizes[2],
266
270
  cost.data<scalar_t>(),
267
271
  col4row.data<int>(),
268
272
  row4col.data<int>());
269
- }));
273
+ });
270
274
  return {col4row, row4col};
271
275
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: torch-linear-assignment
3
- Version: 0.0.1.post3
3
+ Version: 0.0.2
4
4
  Summary: Batched linear assignment with PyTorch and CUDA.
5
5
  Author: Ivan Karpukhin
6
6
  Author-email: karpuhini@yandex.ru