1 /* Copyright 2015 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #if GOOGLE_CUDA 17 18 #define EIGEN_USE_GPU 19 20 #include "tensorflow/core/kernels/scatter_functor_gpu.cu.h" 21 22 namespace tensorflow { 23 24 typedef Eigen::GpuDevice GPUDevice; 25 26 // Instantiates functor specializations for GPU. 27 #define DEFINE_GPU_SPECS_OP(T, Index, op) \ 28 template struct functor::ScatterFunctor<GPUDevice, T, Index, op>; 29 30 #define DEFINE_GPU_SPECS_INDEX(T, Index) \ 31 DEFINE_GPU_SPECS_OP(T, Index, scatter_op::UpdateOp::ASSIGN); \ 32 DEFINE_GPU_SPECS_OP(T, Index, scatter_op::UpdateOp::ADD); \ 33 DEFINE_GPU_SPECS_OP(T, Index, scatter_op::UpdateOp::SUB); \ 34 DEFINE_GPU_SPECS_OP(T, Index, scatter_op::UpdateOp::MUL); \ 35 DEFINE_GPU_SPECS_OP(T, Index, scatter_op::UpdateOp::DIV); 36 37 #define DEFINE_GPU_SPECS(T) \ 38 DEFINE_GPU_SPECS_INDEX(T, int32); \ 39 DEFINE_GPU_SPECS_INDEX(T, int64); 40 41 DEFINE_GPU_SPECS(float); 42 DEFINE_GPU_SPECS(double); 43 // TODO: The following fails to compile. 44 // TF_CALL_GPU_NUMBER_TYPES(DEFINE_GPU_SPECS); 45 46 #undef DEFINE_GPU_SPECS 47 #undef DEFINE_GPU_SPECS_INDEX 48 #undef DEFINE_GPU_SPECS_OP 49 50 } // namespace tensorflow 51 52 #endif // GOOGLE_CUDA 53