Skip to content

Commit

Permalink
Merge pull request #40 from hughperkins/try-travis
Browse files Browse the repository at this point in the history
change math ops to non-native, add back to travis
  • Loading branch information
hughperkins committed Jan 5, 2016
2 parents 15184f6 + f6b4109 commit e10eb7c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ before_install:
- mv ~install.sh install.sh
- chmod +x install.sh
- cat install.sh
- for pkg in exe/luajit-rocks extra/nn pkg/cwrap pkg/paths pkg/sundown pkg/sys pkg/torch pkg/paths; do { git submodule update --init $pkg; } done
- for pkg in exe/luajit-rocks extra/nn pkg/cwrap pkg/paths pkg/sundown pkg/sys pkg/torch pkg/paths; do { git submodule update --quiet --init $pkg; } done
- 'sed -i -e ''s/\(.*STATIC.*\)/# \1/'' pkg/torch/lib/TH/CMakeLists.txt pkg/torch/lib/luaT/CMakeLists.txt'
- 'awk ''/_static PROPERTIES/{printf $0; next}1'' pkg/torch/cmake/TorchPackage.cmake > pkg/torch/cmake/~TorchPackage.cmake'
- mv pkg/torch/cmake/~TorchPackage.cmake pkg/torch/cmake/TorchPackage.cmake
- 'sed -i -e ''s/\(.*static.*\)/# \1/'' pkg/torch/cmake/TorchPackage.cmake'
- cat pkg/torch/cmake/TorchPackage.cmake
- sed -i -e 's/$(MAKE)/$(MAKE) -j 4/' pkg/torch/rocks/torch-scm-1.rockspec
- ./install.sh -b
- ./install.sh -b >/dev/null
- mkdir ~/git
- cd ~/git
- cd ~/build/hughperkins/cltorch
Expand All @@ -38,7 +38,7 @@ script:
- luajit -l cltorch -e "cltorch.setAllowNonGpus(1); print(cltorch.getDeviceCount())"
- 'luajit -e "require ''cltorch''; cltorch.setAllowNonGpus(1); print(cltorch.getDeviceCount())"'
- luajit -l cltorch -e "cltorch.setAllowNonGpus(1); props = cltorch.getDeviceProperties(1); for k,v in pairs(props) do print(k,v) end"
- export TEST_EXCLUDES=inplace_exp,inplace_sqrt,outplace_exp,outplace_sqrt,test_blas,test_cumprod,test_cumsum,test_equals,test_indexcopy,test_indexfill,test_matrixwide,test_max2,test_mean,test_meanall,test_min2,test_norm,test_prod,test_prodall,test_sum_t,test_sumallt,test_reduceAll,test_sum,test_sum_t_offset,test_sumall
- export TEST_EXCLUDES=test_blas,test_cumprod,test_cumsum,test_equals,test_indexcopy,test_indexfill,test_matrixwide,test_max2,test_mean,test_meanall,test_min2,test_norm,test_prod,test_prodall,test_sum_t,test_sumallt,test_reduceAll,test_sum,test_sum_t_offset,test_sumall
- 'luajit -l cltorch -e "cltorch.setAllowNonGpus(1); cltorch.test()"'

notifications:
Expand Down
44 changes: 23 additions & 21 deletions src/lib/THClTensorMathPointwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,42 @@ using namespace std;
void THClTensor_##NAME(THClState* state, THClTensor* self_, THClTensor* src) { \
THAssert(THClTensor_checkGPU(state, 2, self_, src)); \
if (self_ == src) { \
TensorGenOp op(#CFUNC); \
TensorGenOp op(CFUNC); \
if (!THClTensor_pointwiseApply1(state, self_, &op)) { \
THArgCheck(false, 2, CLTORCH_DIM_WARNING); \
} \
} else { \
THClTensor_resizeAs(state, self_, src); \
\
TensorGenOp op(#CFUNC); \
TensorGenOp op(CFUNC); \
if (!THClTensor_pointwiseApply2(state, self_, src, &op)) { \
THArgCheck(false, 2, CLTORCH_DIM_WARNING); \
} \
} \
\
}

IMPLEMENT_CL_TENSOR_BASIC_FUNC(log, native_log)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(log1p, log1p)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(exp, native_exp)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(cos, native_cos)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(acos, acos)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(cosh, cosh)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(sin, native_sin)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(asin, asin)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(sinh, sinh)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(tan, native_tan)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(pow, native_powr)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(atan, atan)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(tanh, tanh)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(sqrt, native_sqrt)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(ceil, ceil)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(floor, floor)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(abs, fabs)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(round, round)
IMPLEMENT_CL_TENSOR_BASIC_FUNC(neg, -)
#define MATHMODE "" // eg "native_" "half_"

IMPLEMENT_CL_TENSOR_BASIC_FUNC(log, MATHMODE "log")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(log1p, "log1p")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(exp, MATHMODE "exp")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(cos, MATHMODE "cos")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(acos, "acos")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(cosh, "cosh")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(sin, MATHMODE "sin")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(asin, "asin")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(sinh, "sinh")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(tan, MATHMODE "tan")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(pow, MATHMODE "powr")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(atan, "atan")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(tanh, "tanh")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(sqrt, MATHMODE "sqrt")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(ceil, "ceil")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(floor, "floor")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(abs, "fabs")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(round, "round")
IMPLEMENT_CL_TENSOR_BASIC_FUNC(neg, "-")

#undef IMPLEMENT_CL_TENSOR_BASIC_FUNC

Expand Down

0 comments on commit e10eb7c

Please sign in to comment.