Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change math ops to non-native, add back to travis #40

Merged
merged 1 commit into from
Jan 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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