Skip to content

Commit

Permalink
windows build fixes (#238)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Gorski <jasongorski@users.noreply.github.com>
  • Loading branch information
jasongorski committed May 5, 2020
1 parent 110deee commit efabf2d
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ full test:
- source setenv.sh
- python setup.py develop
- pytest --cov=kaolin/ tests/
- ./tests/examples/run/test_classification.sh
- ./tests/examples/run/test_nmr.sh
- ./tests/examples/run/test_softras_examples.sh
- tests/examples/run/test_classification.sh
- tests/examples/run/test_nmr.sh
- tests/examples/run/test_softras_examples.sh
4 changes: 3 additions & 1 deletion kaolin/cuda/cuda_util.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,9 @@

// #include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>
#ifndef __NVCC__
#include <torch/extension.h>
#endif
#include <cmath>

#include <cuda.h>
Expand Down
4 changes: 2 additions & 2 deletions kaolin/cuda/mesh_intersection.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@
using namespace std;

// CUDA forward declarations
int MeshIntersectionKernelLauncher(
void MeshIntersectionKernelLauncher(
const float* points,
const float* verts_1,
const float* verts_2,
Expand Down
3 changes: 1 addition & 2 deletions kaolin/cuda/mesh_intersection_cuda.cu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <torch/extension.h>
#include <iostream>

using namespace std;
Expand Down
4 changes: 1 addition & 3 deletions kaolin/cuda/sided_distance_cuda.cu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) [year] [fullname]
// Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.

// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
Expand All @@ -17,8 +17,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#include <torch/extension.h>

#include <cuda.h>
#include <cuda_runtime.h>
#include "device_atomic_functions.h"
Expand Down
4 changes: 2 additions & 2 deletions kaolin/graphics/dib_renderer/cuda/rasterizer_cuda_back.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -28,7 +28,7 @@
#define eps 1e-15

// for the older gpus atomicAdd with double arguments does not exist
#if __CUDA_ARCH__ < 600 and defined(__CUDA_ARCH__)
#if __CUDA_ARCH__ < 600 && defined(__CUDA_ARCH__)
static __inline__ __device__ double atomicAdd(double *address, double val) {
unsigned long long int *address_as_ull = (unsigned long long int *)address;
unsigned long long int old = *address_as_ull, assumed;
Expand Down
6 changes: 3 additions & 3 deletions kaolin/graphics/softras/cuda/soft_rasterize_cuda_kernel.cu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
// #
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,7 +43,7 @@
#include <cuda_runtime.h>

// for the older gpus atomicAdd with double arguments does not exist
#if __CUDA_ARCH__ < 600 and defined(__CUDA_ARCH__)
#if __CUDA_ARCH__ < 600 && defined(__CUDA_ARCH__)
static __inline__ __device__ double atomicAdd(double* address, double val) {
unsigned long long int* address_as_ull = (unsigned long long int*)address;
unsigned long long int old = *address_as_ull, assumed;
Expand Down Expand Up @@ -815,4 +815,4 @@ std::vector<at::Tensor> backward_soft_rasterize_cuda(
printf("Error in backward_soft_rasterize: %s\n", cudaGetErrorString(err));

return {grad_faces, grad_textures};
}
}
22 changes: 13 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,24 @@ def read(*names, **kwargs):


def KaolinCUDAExtension(*args, **kwargs):
FLAGS = ['-Wno-deprecated-declarations']
kwargs = copy.deepcopy(kwargs)
if 'extra_compile_args' in kwargs:
kwargs['extra_compile_args'] += FLAGS
else:
kwargs['extra_compile_args'] = FLAGS
if not os.name == 'nt':
FLAGS = ['-Wno-deprecated-declarations']
kwargs = copy.deepcopy(kwargs)
if 'extra_compile_args' in kwargs:
kwargs['extra_compile_args'] += FLAGS
else:
kwargs['extra_compile_args'] = FLAGS

return CUDAExtension(*args, **kwargs)


class KaolinBuildExtension(BuildExtension):
def build_extensions(self):
FLAG_BLACKLIST = ['-Wstrict-prototypes']
FLAGS = ['-Wno-deprecated-declarations']
self.compiler.compiler_so = [x for x in self.compiler.compiler_so if x not in FLAG_BLACKLIST] + FLAGS # Covers non-cuda
if not os.name == 'nt':
FLAG_BLACKLIST = ['-Wstrict-prototypes']
FLAGS = ['-Wno-deprecated-declarations']
self.compiler.compiler_so = [x for x in self.compiler.compiler_so if x not in FLAG_BLACKLIST] + FLAGS # Covers non-cuda

super().build_extensions()


Expand Down

0 comments on commit efabf2d

Please sign in to comment.