Repository: incubator-singa Updated Branches: refs/heads/master f495ff360 -> e385d2a81
singa incubating 0.2.0 RC2; update license header for common.cc Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/e385d2a8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/e385d2a8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/e385d2a8 Branch: refs/heads/master Commit: e385d2a81d0caaa3a343cb567bae16cf951a3d49 Parents: f495ff3 Author: Wei Wang <[email protected]> Authored: Mon Jan 11 10:54:22 2016 +0800 Committer: Wei Wang <[email protected]> Committed: Mon Jan 11 10:56:05 2016 +0800 ---------------------------------------------------------------------- include/singa/utils/cuda_utils.h | 48 +++++++++++++++++++++++++++++++++++ src/utils/common.cc | 1 + 2 files changed, 49 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e385d2a8/include/singa/utils/cuda_utils.h ---------------------------------------------------------------------- diff --git a/include/singa/utils/cuda_utils.h b/include/singa/utils/cuda_utils.h new file mode 100644 index 0000000..1270e92 --- /dev/null +++ b/include/singa/utils/cuda_utils.h @@ -0,0 +1,48 @@ +/************************************************************ +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +/** + * The code is adapted from that of Caffe which is under BSD 2 Clause License. + * + * COPYRIGHT + * All contributions by the University of California: + * Copyright (c) 2014, The Regents of the University of California (Regents) + * All rights reserved. + * All other contributions: + * Copyright (c) 2014, the respective contributors + * All rights reserved. + */ +#ifndef SINGA_UTILS_CUDA_UTILS_H_ +#define SINGA_UTILS_CUDA_UTILS_H_ +#include <cublas_v2.h> +#include <cuda.h> +#include <cuda_runtime.h> +#include <curand.h> + +// CUDA: various checks for different function calls. +#define CUDA_CHECK(condition) \ + /* Code block avoids redefinition of cudaError_t error */ \ + do { \ + cudaError_t error = condition; \ + CHECK_EQ(error, cudaSuccess) << " " << cudaGetErrorString(error); \ + } while (0) + +#endif // SINGA_UTILS_CUDA_UTILS_H_ http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e385d2a8/src/utils/common.cc ---------------------------------------------------------------------- diff --git a/src/utils/common.cc b/src/utils/common.cc index fe14dc4..bd0fee5 100644 --- a/src/utils/common.cc +++ b/src/utils/common.cc @@ -20,6 +20,7 @@ *************************************************************/ /** + * The code is adapted from Caffe under BSD 2 Clause license. * All contributions by the University of California: * Copyright (c) 2014, The Regents of the University of California (Regents) * All rights reserved.
