Skip to content

Commit

Permalink
fix errors in vs2017 building
Browse files Browse the repository at this point in the history
  • Loading branch information
hzli-ucas committed Mar 17, 2019
1 parent 596bcc6 commit a19202c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ IF (CUDA_VERSION GREATER 7.6)
ENDIF()

IF (CUDA_VERSION GREATER 8.9)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_70,code=sm_70")
#set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_70,code=sm_70")
ENDIF()

if (NOT APPLE)
Expand Down
8 changes: 4 additions & 4 deletions include/ctc.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ typedef enum {
} ctcStatus_t;

/** Returns a single integer which specifies the API version of the warpctc library */
int get_warpctc_version();
__declspec(dllexport) int get_warpctc_version();

/** Returns a string containing a description of status that was passed in
* \param[in] status identifies which string should be returned
* \return C style string containing the text description
* */
const char* ctcGetStatusString(ctcStatus_t status);
__declspec(dllexport) const char* ctcGetStatusString(ctcStatus_t status);

typedef enum {
CTC_CPU = 0,
Expand Down Expand Up @@ -91,7 +91,7 @@ struct ctcOptions {
* \return Status information
*
* */
ctcStatus_t compute_ctc_loss(const float* const activations,
__declspec(dllexport) ctcStatus_t compute_ctc_loss(const float* const activations,
float* gradients,
const int* const flat_labels,
const int* const label_lengths,
Expand Down Expand Up @@ -120,7 +120,7 @@ ctcStatus_t compute_ctc_loss(const float* const activations,
*
* \return Status information
**/
ctcStatus_t get_workspace_size(const int* const label_lengths,
__declspec(dllexport) ctcStatus_t get_workspace_size(const int* const label_lengths,
const int* const input_lengths,
int alphabet_size, int minibatch,
ctcOptions info,
Expand Down
13 changes: 5 additions & 8 deletions pytorch_binding/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
import torch

extra_compile_args = ['-std=c++11', '-fPIC']
warp_ctc_path = "../build"
warp_ctc_path = "../build/Release"

if platform.system() == 'Darwin':
lib_ext = ".dylib"
else:
lib_ext = ".so"
lib_ext = ".dll"

if "WARP_CTC_PATH" in os.environ:
warp_ctc_path = os.environ["WARP_CTC_PATH"]
if not os.path.exists(os.path.join(warp_ctc_path, "libwarpctc" + lib_ext)):
print(("Could not find libwarpctc.so in {}.\n"
if not os.path.exists(os.path.join(warp_ctc_path, "warpctc" + lib_ext)):
print(("Could not find warpctc.dll in {}.\n"
"Build warp-ctc and set WARP_CTC_PATH to the location of"
" libwarpctc.so (default is '../build')").format(warp_ctc_path))
" warpctc.dll (default is '%s')").format(warp_ctc_path))
sys.exit(1)

include_dirs = [os.path.realpath('../include')]
Expand Down
2 changes: 1 addition & 1 deletion pytorch_binding/src/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "ATen/cuda/CUDAEvent.h"

#include "THC.h"
extern THCState* state;
THCState* state = at::globalContext().lazyInitCUDA();
#endif

#include "ctc.h"
Expand Down
2 changes: 1 addition & 1 deletion src/ctc_entrypoint.cu
2 changes: 1 addition & 1 deletion tests/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <vector>
#include <limits>
#include <numeric>

#include <algorithm>

#include <ctc.h>

Expand Down

0 comments on commit a19202c

Please sign in to comment.