| |
| ***************************************************** |
| Summary |
| ------- |
| Generated at: 2016-08-17T13:11:07+08:00 |
| Notes: 5 |
| Binaries: 0 |
| Archives: 0 |
| Standards: 288 |
| |
| Apache Licensed: 269 |
| Generated Documents: 0 |
| |
| JavaDocs are generated and so license header is optional |
| Generated files do not required license headers |
| |
| 18 Unknown Licenses |
| |
| ******************************* |
| |
| Unapproved licenses: |
| |
| ./.gitmodules |
| ./.travis.yml |
| ./rat_check |
| ./cmake/Protobuf.cmake |
| ./cmake/Thirdparty/FindOpenCL.cmake |
| ./include/singa/utils/cuda_utils.h |
| ./include/singa/utils/tinydir.h |
| ./lib/cnmem/.git |
| ./lib/cnmem/CMakeLists.txt |
| ./lib/cnmem/include/cnmem.h |
| ./lib/cnmem/src/cnmem.cpp |
| ./lib/cnmem/tests/cnmem_tests.cpp |
| ./src/core/tensor/distribution.cl |
| ./src/python/swig/numpy.i |
| ./test/gtest/gtest-all.cc |
| ./test/gtest/gtest.h |
| ./test/gtest/gtest_main.cc |
| ./tool/cpplint.py |
| |
| ******************************* |
| |
| Archives: |
| |
| ***************************************************** |
| Files with Apache License headers will be marked AL |
| Binary files (which do not require AL headers) will be marked B |
| Compressed archives will be marked A |
| Notices, licenses etc will be marked N |
| !????? ./.gitmodules |
| !????? ./.travis.yml |
| AL ./CMakeLists.txt |
| N ./DISCLAIMER |
| N ./LICENSE |
| N ./NOTICE |
| N ./RELEASE_NOTES |
| AL ./jenkins.sh |
| !????? ./rat_check |
| AL ./bin/singa-cleanup.sh |
| AL ./bin/singa-console.sh |
| AL ./bin/singa-env.sh |
| AL ./bin/singa-run.sh |
| AL ./bin/singa-stop.sh |
| AL ./bin/zk-service.sh |
| AL ./cmake/Cuda.cmake |
| AL ./cmake/Dependencies.cmake |
| !????? ./cmake/Protobuf.cmake |
| AL ./cmake/Utils.cmake |
| AL ./cmake/Templates/singa_config.h.in |
| AL ./cmake/Thirdparty/FindCBLAS.cmake |
| AL ./cmake/Thirdparty/FindCUDNN.cmake |
| AL ./cmake/Thirdparty/FindGlog.cmake |
| AL ./cmake/Thirdparty/FindLMDB.cmake |
| !????? ./cmake/Thirdparty/FindOpenCL.cmake |
| AL ./examples/CMakeLists.txt |
| AL ./examples/index.rst |
| AL ./examples/char-rnn/sample.py |
| AL ./examples/char-rnn/train.py |
| AL ./examples/cifar10/CMakeLists.txt |
| AL ./examples/cifar10/alexnet-parallel.cc |
| AL ./examples/cifar10/alexnet.cc |
| AL ./examples/cifar10/alexnet.py |
| AL ./examples/cifar10/cifar10.h |
| AL ./examples/cifar10/download_data.py |
| AL ./examples/cifar10/predict.py |
| AL ./examples/cifar10/run-parallel.sh |
| AL ./examples/cifar10/run.sh |
| AL ./examples/cifar10/train.py |
| AL ./examples/cifar10/vgg-parallel.cc |
| AL ./examples/cifar10/vgg.py |
| AL ./examples/imagenet/CMakeLists.txt |
| AL ./examples/imagenet/alexnet.cc |
| AL ./examples/imagenet/create_data.sh |
| AL ./examples/imagenet/ilsvrc12.cc |
| AL ./examples/imagenet/ilsvrc12.h |
| AL ./examples/imagenet/run.sh |
| AL ./examples/mnist/train.py |
| AL ./include/singa/core/common.h |
| AL ./include/singa/core/device.h |
| AL ./include/singa/core/memory.h |
| AL ./include/singa/core/scheduler.h |
| AL ./include/singa/core/tensor.h |
| AL ./include/singa/io/decoder.h |
| AL ./include/singa/io/encoder.h |
| AL ./include/singa/io/integer.h |
| AL ./include/singa/io/network.h |
| AL ./include/singa/io/reader.h |
| AL ./include/singa/io/snapshot.h |
| AL ./include/singa/io/transformer.h |
| AL ./include/singa/io/writer.h |
| AL ./include/singa/model/feed_forward_net.h |
| AL ./include/singa/model/initializer.h |
| AL ./include/singa/model/layer.h |
| AL ./include/singa/model/loss.h |
| AL ./include/singa/model/metric.h |
| AL ./include/singa/model/optimizer.h |
| AL ./include/singa/model/updater.h |
| AL ./include/singa/utils/channel.h |
| !????? ./include/singa/utils/cuda_utils.h |
| AL ./include/singa/utils/factory.h |
| AL ./include/singa/utils/integer.h |
| AL ./include/singa/utils/logging.h |
| AL ./include/singa/utils/opencl_utils.h |
| AL ./include/singa/utils/safe_queue.h |
| AL ./include/singa/utils/singleton.h |
| AL ./include/singa/utils/string.h |
| AL ./include/singa/utils/timer.h |
| !????? ./include/singa/utils/tinydir.h |
| !????? ./lib/cnmem/.git |
| !????? ./lib/cnmem/CMakeLists.txt |
| N ./lib/cnmem/LICENSE |
| !????? ./lib/cnmem/include/cnmem.h |
| !????? ./lib/cnmem/src/cnmem.cpp |
| !????? ./lib/cnmem/tests/cnmem_tests.cpp |
| AL ./src/CMakeLists.txt |
| AL ./src/core/device/cpp_cpu.cc |
| AL ./src/core/device/cuda_gpu.cc |
| AL ./src/core/device/device.cc |
| AL ./src/core/device/opencl_device.cc |
| AL ./src/core/device/platform.cc |
| AL ./src/core/memory/memory.cc |
| AL ./src/core/scheduler/scheduler.cc |
| !????? ./src/core/tensor/distribution.cl |
| AL ./src/core/tensor/math_kernel.cu |
| AL ./src/core/tensor/math_kernel.h |
| AL ./src/core/tensor/sparse_tensor.cc |
| AL ./src/core/tensor/tensor.cc |
| AL ./src/core/tensor/tensor_math.h |
| AL ./src/core/tensor/tensor_math_cpp.h |
| AL ./src/core/tensor/tensor_math_cuda.h |
| AL ./src/core/tensor/tensor_math_opencl.cl |
| AL ./src/core/tensor/tensor_math_opencl.h |
| AL ./src/io/binfile_reader.cc |
| AL ./src/io/binfile_writer.cc |
| AL ./src/io/csv_decoder.cc |
| AL ./src/io/csv_encoder.cc |
| AL ./src/io/image_transformer.cc |
| AL ./src/io/jpg_decoder.cc |
| AL ./src/io/jpg_encoder.cc |
| AL ./src/io/lmdb_reader.cc |
| AL ./src/io/lmdb_writer.cc |
| AL ./src/io/snapshot.cc |
| AL ./src/io/textfile_reader.cc |
| AL ./src/io/textfile_writer.cc |
| AL ./src/io/network/endpoint.cc |
| AL ./src/io/network/message.cc |
| AL ./src/model/feed_forward_net.cc |
| AL ./src/model/rnn.cc |
| AL ./src/model/layer/activation.cc |
| AL ./src/model/layer/activation.h |
| AL ./src/model/layer/batchnorm.cc |
| AL ./src/model/layer/batchnorm.h |
| AL ./src/model/layer/convolution.cc |
| AL ./src/model/layer/convolution.h |
| AL ./src/model/layer/cudnn_activation.cc |
| AL ./src/model/layer/cudnn_activation.h |
| AL ./src/model/layer/cudnn_batchnorm.cc |
| AL ./src/model/layer/cudnn_batchnorm.h |
| AL ./src/model/layer/cudnn_convolution.cc |
| AL ./src/model/layer/cudnn_convolution.h |
| AL ./src/model/layer/cudnn_dropout.cc |
| AL ./src/model/layer/cudnn_dropout.h |
| AL ./src/model/layer/cudnn_lrn.cc |
| AL ./src/model/layer/cudnn_lrn.h |
| AL ./src/model/layer/cudnn_pooling.cc |
| AL ./src/model/layer/cudnn_pooling.h |
| AL ./src/model/layer/cudnn_rnn.cc |
| AL ./src/model/layer/cudnn_rnn.h |
| AL ./src/model/layer/cudnn_softmax.cc |
| AL ./src/model/layer/cudnn_softmax.h |
| AL ./src/model/layer/cudnn_utils.h |
| AL ./src/model/layer/dense.cc |
| AL ./src/model/layer/dense.h |
| AL ./src/model/layer/dropout.cc |
| AL ./src/model/layer/dropout.h |
| AL ./src/model/layer/flatten.cc |
| AL ./src/model/layer/flatten.h |
| AL ./src/model/layer/lrn.cc |
| AL ./src/model/layer/lrn.h |
| AL ./src/model/layer/pooling.cc |
| AL ./src/model/layer/pooling.h |
| AL ./src/model/layer/prelu.cc |
| AL ./src/model/layer/prelu.h |
| AL ./src/model/layer/rnn.cc |
| AL ./src/model/layer/rnn.h |
| AL ./src/model/layer/softmax.cc |
| AL ./src/model/layer/softmax.h |
| AL ./src/model/loss/mse.cc |
| AL ./src/model/loss/softmax_cross_entropy.cc |
| AL ./src/model/metric/accuracy.cc |
| AL ./src/model/optimizer/adagrad.cc |
| AL ./src/model/optimizer/local_all_reduce.cc |
| AL ./src/model/optimizer/nesterov.cc |
| AL ./src/model/optimizer/optimizer.cc |
| AL ./src/model/optimizer/rmsprop.cc |
| AL ./src/model/optimizer/sgd.cc |
| AL ./src/model/updater/local_updater.cc |
| AL ./src/model/updater/updater.cc |
| AL ./src/proto/core.proto |
| AL ./src/proto/io.proto |
| AL ./src/proto/model.proto |
| AL ./src/python/setup.py.in |
| AL ./src/python/singa/__init__.py |
| AL ./src/python/singa/command.py |
| AL ./src/python/singa/device.py |
| AL ./src/python/singa/initializer.py |
| AL ./src/python/singa/layer.py |
| AL ./src/python/singa/loss.py |
| AL ./src/python/singa/metric.py |
| AL ./src/python/singa/model.py |
| AL ./src/python/singa/net.py |
| AL ./src/python/singa/optimizer.py |
| AL ./src/python/singa/tensor.py |
| AL ./src/python/singa/utils.py |
| AL ./src/python/swig/core_device.i |
| AL ./src/python/swig/core_tensor.i |
| AL ./src/python/swig/model_layer.i |
| AL ./src/python/swig/model_loss.i |
| AL ./src/python/swig/model_metric.i |
| AL ./src/python/swig/model_optimizer.i |
| !????? ./src/python/swig/numpy.i |
| AL ./src/python/swig/singa.i |
| ./src/python/swig/singa_wrap.cxx |
| AL ./src/utils/channel.cc |
| AL ./src/utils/logging.cc |
| AL ./src/utils/opencl_utils.cc |
| AL ./test/CMakeLists.txt |
| AL ./test/gtest/CMakeLists.txt |
| !????? ./test/gtest/gtest-all.cc |
| !????? ./test/gtest/gtest.h |
| !????? ./test/gtest/gtest_main.cc |
| AL ./test/python/test_layer.py |
| AL ./test/python/test_optimizer.py |
| AL ./test/python/test_tensor.py |
| AL ./test/singa/test_accuracy.cc |
| AL ./test/singa/test_activation.cc |
| AL ./test/singa/test_adagrad.cc |
| AL ./test/singa/test_batchnorm.cc |
| AL ./test/singa/test_binfile_rw.cc |
| AL ./test/singa/test_channel.cc |
| AL ./test/singa/test_convolution.cc |
| AL ./test/singa/test_cpp_cpu.cc |
| AL ./test/singa/test_cross_entropy.cc |
| AL ./test/singa/test_csv.cc |
| AL ./test/singa/test_cudnn_activation.cc |
| AL ./test/singa/test_cudnn_batchnorm.cc |
| AL ./test/singa/test_cudnn_convolution.cc |
| AL ./test/singa/test_cudnn_dropout.cc |
| AL ./test/singa/test_cudnn_lrn.cc |
| AL ./test/singa/test_cudnn_pooling.cc |
| AL ./test/singa/test_cudnn_rnn.cc |
| AL ./test/singa/test_cudnn_softmax.cc |
| AL ./test/singa/test_dense.cc |
| AL ./test/singa/test_dropout.cc |
| AL ./test/singa/test_ep.cc |
| AL ./test/singa/test_flatten.cc |
| AL ./test/singa/test_image_transformer.cc |
| AL ./test/singa/test_initializer.cc |
| AL ./test/singa/test_jpg.cc |
| AL ./test/singa/test_layer.cc |
| AL ./test/singa/test_lmdb_rw.cc |
| AL ./test/singa/test_logging.cc |
| AL ./test/singa/test_lrn.cc |
| AL ./test/singa/test_memory.cc |
| AL ./test/singa/test_mse.cc |
| AL ./test/singa/test_nesterov.cc |
| AL ./test/singa/test_opencl.cc |
| AL ./test/singa/test_platform.cc |
| AL ./test/singa/test_pooling.cc |
| AL ./test/singa/test_prelu.cc |
| AL ./test/singa/test_rmsprop.cc |
| AL ./test/singa/test_sgd.cc |
| AL ./test/singa/test_snapshot.cc |
| AL ./test/singa/test_softmax.cc |
| AL ./test/singa/test_tensor.cc |
| AL ./test/singa/test_tensor_math.cc |
| AL ./test/singa/test_textfile_rw.cc |
| AL ./test/singa/test_timer.cc |
| AL ./thirdparty/install.sh |
| !????? ./tool/cpplint.py |
| AL ./tool/graph.py |
| AL ./tool/node.sh |
| AL ./tool/docker/mesos/.bashrc |
| AL ./tool/docker/mesos/Dockerfile |
| AL ./tool/docker/mesos/core-site.xml |
| AL ./tool/docker/mesos/hdfs-site.xml |
| AL ./tool/docker/mesos/install.sh |
| AL ./tool/docker/mesos/mapred-site.xml |
| AL ./tool/docker/mesos/yarn-site.xml |
| AL ./tool/docker/singa/.bashrc |
| AL ./tool/docker/singa/Dockerfile |
| AL ./tool/docker/singa/Dockerfile_gpu |
| AL ./tool/mesos/scheduler.proto |
| AL ./tool/mesos/singa_scheduler.cc |
| AL ./tool/python/singa.py |
| AL ./tool/python/examples/__init__.py |
| AL ./tool/python/examples/cifar10_cnn.py |
| AL ./tool/python/examples/cifar10_cnn_cudnn.py |
| AL ./tool/python/examples/cifar10_cnn_parameter.py |
| AL ./tool/python/examples/mnist_ae.py |
| AL ./tool/python/examples/mnist_mlp.py |
| AL ./tool/python/examples/mnist_mlp_parameter.py |
| AL ./tool/python/examples/mnist_mlp_test.py |
| AL ./tool/python/examples/mnist_rbm1.py |
| AL ./tool/python/examples/mnist_rbm2.py |
| AL ./tool/python/examples/mnist_rbm3.py |
| AL ./tool/python/examples/mnist_rbm4.py |
| AL ./tool/python/examples/train_cifar10.py |
| AL ./tool/python/examples/train_mnist.py |
| AL ./tool/python/examples/datasets/__init__.py |
| AL ./tool/python/examples/datasets/cifar10.py |
| AL ./tool/python/examples/datasets/mnist.py |
| AL ./tool/python/singa/__init__.py |
| AL ./tool/python/singa/driver.i |
| AL ./tool/python/singa/generatepy.sh |
| AL ./tool/python/singa/initializations.py |
| AL ./tool/python/singa/layer.py |
| AL ./tool/python/singa/model.py |
| AL ./tool/python/singa/parameter.py |
| AL ./tool/python/singa/utils/__init__.py |
| AL ./tool/python/singa/utils/message.py |
| AL ./tool/python/singa/utils/utility.py |
| |
| ***************************************************** |
| Printing headers for files without AL header... |
| |
| |
| ======================================================================= |
| ==./.gitmodules |
| ======================================================================= |
| [submodule "lib/cnmem"] |
| path = lib/cnmem |
| url = https://github.com/NVIDIA/cnmem.git |
| |
| ======================================================================= |
| ==./.travis.yml |
| ======================================================================= |
| sudo: required |
| language: cpp |
| compiler: gcc |
| dist: trusty |
| |
| before_install: |
| - sudo apt-get -qq update |
| - sudo apt-get install -qq -y libopenblas-dev libgoogle-glog-dev libprotobuf-dev protobuf-compiler |
| - sudo apt-get install -qq -y opencl-headers ocl-icd-* |
| - wget https://github.com/KhronosGroup/OpenCL-CLHPP/releases/download/v2.0.9/cl2.hpp |
| - sudo mv cl2.hpp /usr/include/CL/ |
| #- sudo apt-get install -qq libgtest-dev |
| |
| before_script: |
| - mkdir build && cd build |
| - cmake .. -DUSE_CUDA=OFF -DUSE_CUDNN=OFF -DUSE_PYTHON=OFF -DBUILD_OPENCL_TESTS=OFF |
| |
| script: |
| - make |
| - ./bin/test_singa --gtest_output=xml:./../gtest.xml |
| |
| |
| ======================================================================= |
| ==./rat_check |
| ======================================================================= |
| |
| ======================================================================= |
| ==./cmake/Protobuf.cmake |
| ======================================================================= |
| # This script is taken from |
| # https://github.com/Kitware/CMake/blob/master/Modules/FindProtobuf.cmake |
| # and modified to our compilation. |
| |
| function(PROTOBUF_GENERATE_PYTHON OUTPUT) |
| if(NOT ARGN) |
| message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called |
| without any proto files") |
| return() |
| endif(NOT ARGN) |
| |
| set(${OUTPUT}) |
| foreach(FIL ${ARGN}) |
| get_filename_component(ABS_FIL ${FIL} ABSOLUTE) |
| get_filename_component(FIL_WE ${FIL} NAME_WE) |
| get_filename_component(PATH ${FIL} PATH) |
| |
| list(APPEND ${OUTPUT} "${CMAKE_BINARY_DIR}/python/singa/proto/${FIL_WE}_pb2.py") |
| |
| add_custom_command( |
| OUTPUT "${CMAKE_BINARY_DIR}/python/singa/proto/${FIL_WE}_pb2.py" |
| COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} |
| ARGS --python_out ${CMAKE_BINARY_DIR}/python/singa/proto |
| --proto_path ${PATH} ${ABS_FIL} |
| DEPENDS ${ABS_FIL} |
| COMMENT "Running Python protocol buffer compiler on ${FIL}" VERBATIM) |
| endforeach() |
| |
| set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) |
| set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) |
| endfunction() |
| |
| ======================================================================= |
| ==./cmake/Thirdparty/FindOpenCL.cmake |
| ======================================================================= |
| # This script was taken from https://github.com/elhigu/cmake-findopencl |
| # and modified to support finding OpenCL 2.x C++ bindings. |
| |
| # Find OpenCL |
| # |
| # To set manually the paths, define these environment variables: |
| # OpenCL_INCPATH - Include path (e.g. OpenCL_INCPATH=/opt/cuda/4.0/cuda/include) |
| # OpenCL_LIBPATH - Library path (e.h. OpenCL_LIBPATH=/usr/lib64/nvidia) |
| # |
| # Once done this will define |
| # OPENCL_FOUND - system has OpenCL |
| # OPENCL_INCLUDE_DIRS - the OpenCL include directory |
| # OPENCL_LIBRARIES - link these to use OpenCL |
| # OPENCL_HAS_CPP_BINDINGS - system has also cl2.hpp |
| |
| FIND_PACKAGE(PackageHandleStandardArgs) |
| |
| SET (OPENCL_VERSION_STRING "0.1.0") |
| SET (OPENCL_VERSION_MAJOR 0) |
| SET (OPENCL_VERSION_MINOR 1) |
| SET (OPENCL_VERSION_PATCH 0) |
| |
| IF (APPLE) |
| |
| # IF OpenCL_LIBPATH is given use it and don't use default path |
| IF (DEFINED ENV{OpenCL_LIBPATH}) |
| FIND_LIBRARY(OPENCL_LIBRARIES OpenCL PATHS ENV OpenCL_LIBPATH NO_DEFAULT_PATH) |
| ELSE () |
| FIND_LIBRARY(OPENCL_LIBRARIES OpenCL DOC "OpenCL lib for OSX") |
| ENDIF () |
| |
| # IF OpenCL_INCPATH is given use it and find for CL/cl.h and OpenCL/cl.h do not try to find default paths |
| IF (DEFINED ENV{OpenCL_INCPATH}) |
| FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h OpenCL/cl.h PATHS ENV OpenCL_INCPATH NO_DEFAULT_PATH) |
| FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl2.hpp OpenCL/cl2.hpp PATHS ${OPENCL_INCLUDE_DIRS} NO_DEFAULT_PATH) |
| ELSE () |
| FIND_PATH(OPENCL_INCLUDE_DIRS OpenCL/cl.h DOC "Include for OpenCL on OSX") |
| FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS OpenCL/cl2.hpp DOC "Include for OpenCL CPP bindings on OSX") |
| ENDIF () |
| |
| ELSE (APPLE) |
| |
| IF (WIN32) |
| |
| # Find OpenCL includes and libraries from environment variables provided by vendor |
| SET(OPENCL_INCLUDE_SEARCH_PATHS) |
| SET(OPENCL_LIBRARY_SEARCH_PATHS) |
| SET(OPENCL_LIBRARY_64_SEARCH_PATHS) |
| |
| # Nvidia |
| |
| ======================================================================= |
| ==./include/singa/utils/cuda_utils.h |
| ======================================================================= |
| // from caffe include/caffe/util/device_alternative.hpp |
| #ifndef SINGA_UTILS_CUDA_UTILS_H_ |
| #define SINGA_UTILS_CUDA_UTILS_H_ |
| |
| #include "singa/singa_config.h" |
| #ifdef USE_CUDA |
| #include <cublas_v2.h> |
| #include <cuda.h> |
| #include <cuda_runtime.h> |
| #include <curand.h> |
| |
| inline const char* cublasGetErrorString(cublasStatus_t error) { |
| switch (error) { |
| case CUBLAS_STATUS_SUCCESS: |
| return "CUBLAS_STATUS_SUCCESS"; |
| case CUBLAS_STATUS_NOT_INITIALIZED: |
| return "CUBLAS_STATUS_NOT_INITIALIZED"; |
| case CUBLAS_STATUS_ALLOC_FAILED: |
| return "CUBLAS_STATUS_ALLOC_FAILED"; |
| case CUBLAS_STATUS_INVALID_VALUE: |
| return "CUBLAS_STATUS_INVALID_VALUE"; |
| case CUBLAS_STATUS_ARCH_MISMATCH: |
| return "CUBLAS_STATUS_ARCH_MISMATCH"; |
| case CUBLAS_STATUS_MAPPING_ERROR: |
| return "CUBLAS_STATUS_MAPPING_ERROR"; |
| case CUBLAS_STATUS_EXECUTION_FAILED: |
| return "CUBLAS_STATUS_EXECUTION_FAILED"; |
| case CUBLAS_STATUS_INTERNAL_ERROR: |
| return "CUBLAS_STATUS_INTERNAL_ERROR"; |
| #if CUDA_VERSION >= 6000 |
| case CUBLAS_STATUS_NOT_SUPPORTED: |
| return "CUBLAS_STATUS_NOT_SUPPORTED"; |
| #endif |
| #if CUDA_VERSION >= 6050 |
| case CUBLAS_STATUS_LICENSE_ERROR: |
| return "CUBLAS_STATUS_LICENSE_ERROR"; |
| #endif |
| } |
| return "Unknown cublas status"; |
| } |
| |
| inline const char* curandGetErrorString(curandStatus_t error) { |
| switch (error) { |
| case CURAND_STATUS_SUCCESS: |
| return "CURAND_STATUS_SUCCESS"; |
| case CURAND_STATUS_VERSION_MISMATCH: |
| return "CURAND_STATUS_VERSION_MISMATCH"; |
| case CURAND_STATUS_NOT_INITIALIZED: |
| return "CURAND_STATUS_NOT_INITIALIZED"; |
| case CURAND_STATUS_ALLOCATION_FAILED: |
| |
| ======================================================================= |
| ==./include/singa/utils/tinydir.h |
| ======================================================================= |
| /* |
| Copyright (c) 2013-2014, Cong Xu, Baudouin Feildel |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the following conditions are met: |
| |
| 1. Redistributions of source code must retain the above copyright notice, this |
| list of conditions and the following disclaimer. |
| 2. Redistributions in binary form must reproduce the above copyright notice, |
| this list of conditions and the following disclaimer in the documentation |
| and/or other materials provided with the distribution. |
| |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| #ifndef TINYDIR_H |
| #define TINYDIR_H |
| |
| #include <errno.h> |
| #include <stdlib.h> |
| #include <string.h> |
| #ifdef _WIN32 |
| #define WIN32_LEAN_AND_MEAN |
| #include <windows.h> |
| #ifdef _MSC_VER |
| #pragma warning (disable : 4996) |
| #endif |
| #else |
| #include <dirent.h> |
| #include <libgen.h> |
| #include <sys/stat.h> |
| #endif |
| |
| |
| /* types */ |
| |
| #define _TINYDIR_PATH_MAX 4096 |
| #ifdef _WIN32 |
| /* extra chars for the "\\*" mask */ |
| #define _TINYDIR_PATH_EXTRA 2 |
| #else |
| |
| ======================================================================= |
| ==./lib/cnmem/.git |
| ======================================================================= |
| gitdir: ../../.git/modules/lib/cnmem |
| |
| ======================================================================= |
| ==./lib/cnmem/CMakeLists.txt |
| ======================================================================= |
| # CMakeLists to build the cnmem library. |
| cmake_minimum_required(VERSION 2.8.8) |
| project(cnmem) |
| |
| # We need CUDA to build that library. |
| find_package(CUDA QUIET REQUIRED) |
| include_directories(${CUDA_INCLUDE_DIRS}) |
| |
| # Rules to build the cnmem library. |
| include_directories(include) |
| add_definitions(-DCNMEM_DLLEXPORT) |
| add_library(cnmem SHARED src/cnmem.cpp) |
| set_target_properties(cnmem PROPERTIES VERSION 1.0.0 SOVERSION 1) |
| target_link_libraries(cnmem LINK_PUBLIC ${CUDA_LIBRARIES}) |
| install(TARGETS cnmem RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) |
| install(FILES include/cnmem.h DESTINATION include) |
| |
| # Add the tests. |
| if(WITH_TESTS) |
| |
| # Get Google tests. |
| find_package(GTest QUIET REQUIRED) |
| include_directories(${GTEST_INCLUDE_DIRS}) |
| |
| # Build the executable. |
| add_executable(cnmem_tests tests/cnmem_tests.cpp) |
| if(MSVC) |
| if(MSVC_VERSION GREATER 1700) # Visual Studio 11 or more. |
| add_definitions(-DUSE_CPP_11) |
| endif(MSVC_VERSION GREATER 1700) |
| endif(MSVC) |
| if(CMAKE_COMPILER_IS_GNUCC) |
| add_definitions(-std=c++11 -DUSE_CPP_11) |
| endif(CMAKE_COMPILER_IS_GNUCC) |
| target_link_libraries(cnmem_tests LINK_PUBLIC cnmem ${CUDA_LIBRARIES} ${GTEST_LIBRARIES} -lpthread) |
| install(TARGETS cnmem_tests RUNTIME DESTINATION bin) |
| |
| # On Windows, we copy the Google test DLL to the bin folder. |
| if(MSVC) |
| get_filename_component(gtest_dll_path ${GTEST_LIBRARIES} DIRECTORY) |
| install(FILES ${gtest_dll_path}/gtest.dll DESTINATION bin) |
| endif(MSVC) |
| |
| endif(WITH_TESTS) |
| |
| |
| ======================================================================= |
| ==./lib/cnmem/include/cnmem.h |
| ======================================================================= |
| /* ********************************************************************** |
| * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * * Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * * Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
| * * Neither the name of NVIDIA CORPORATION nor the names of its |
| * contributors may be used to endorse or promote products derived |
| * from this software without specific prior written permission. |
| * |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY |
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| * ********************************************************************** */ |
| #pragma once |
| |
| #ifdef __cplusplus |
| #include "cstdio" |
| #else |
| #include "stdio.h" |
| #endif |
| #include "cuda_runtime_api.h" |
| |
| #if defined(_MSC_VER) || defined(WIN32) |
| #ifdef CNMEM_DLLEXPORT |
| #define CNMEM_API __declspec(dllexport) |
| #else |
| #define CNMEM_API __declspec(dllimport) |
| #endif |
| #else |
| #ifdef CNMEM_DLLEXPORT |
| #define CNMEM_API __attribute__((visibility ("default"))) |
| #else |
| #define CNMEM_API |
| #endif |
| #endif |
| |
| |
| ======================================================================= |
| ==./lib/cnmem/src/cnmem.cpp |
| ======================================================================= |
| /////////////////////////////////////////////////////////////////////////////////////////////////// |
| // Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions |
| // are met: |
| // * Redistributions of source code must retain the above copyright |
| // notice, this list of conditions and the following disclaimer. |
| // * Redistributions in binary form must reproduce the above copyright |
| // notice, this list of conditions and the following disclaimer in the |
| // documentation and/or other materials provided with the distribution. |
| // * Neither the name of NVIDIA CORPORATION nor the names of its |
| // contributors may be used to endorse or promote products derived |
| // from this software without specific prior written permission. |
| // |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY |
| // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| /////////////////////////////////////////////////////////////////////////////////////////////////// |
| |
| #include "cnmem.h" |
| #include <cstddef> |
| #include <vector> |
| #include <cuda_runtime_api.h> |
| |
| #if !defined(WIN32) && defined(_MSC_VER) |
| #define WIN32 |
| #endif |
| |
| #ifdef WIN32 |
| #include <Windows.h> |
| #else |
| #include <pthread.h> |
| #endif |
| |
| #if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 4 // ARMv7 is the only 32-bit target that we support. |
| #define CNMEM_BUILD_WITH_32_BIT_POINTERS |
| #endif |
| |
| #define CNMEM_GRANULARITY 512 |
| |
| /////////////////////////////////////////////////////////////////////////////////////////////////// |
| |
| ======================================================================= |
| ==./lib/cnmem/tests/cnmem_tests.cpp |
| ======================================================================= |
| /////////////////////////////////////////////////////////////////////////////////////////////////// |
| // Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions |
| // are met: |
| // * Redistributions of source code must retain the above copyright |
| // notice, this list of conditions and the following disclaimer. |
| // * Redistributions in binary form must reproduce the above copyright |
| // notice, this list of conditions and the following disclaimer in the |
| // documentation and/or other materials provided with the distribution. |
| // * Neither the name of NVIDIA CORPORATION nor the names of its |
| // contributors may be used to endorse or promote products derived |
| // from this software without specific prior written permission. |
| // |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY |
| // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| /////////////////////////////////////////////////////////////////////////////////////////////////// |
| |
| #include <gtest/gtest.h> |
| #include <cnmem.h> |
| #include <fstream> |
| #ifdef USE_CPP_11 |
| #include <thread> |
| #endif |
| |
| /////////////////////////////////////////////////////////////////////////////////////////////////// |
| |
| static std::size_t getFreeMemory() { |
| cudaFree(0); |
| std::size_t freeMem, totalMem; |
| cudaMemGetInfo(&freeMem, &totalMem); |
| return freeMem; |
| } |
| |
| class CnmemTest : public ::testing::Test { |
| /// We determine the amount of free memory. |
| std::size_t mFreeMem; |
| |
| protected: |
| /// Do we test memory leaks. |
| |
| ======================================================================= |
| ==./src/core/tensor/distribution.cl |
| ======================================================================= |
| // This code is adapted from https://github.com/amd/OpenCL-caffe/blob/stable/src/caffe/ocl/random.cl |
| |
| //Note: random generator has two parts |
| //first part: the open sourced threefy random generator kernel from DE Shaw Research |
| //second part. we wrap the kernel up to generate uniform, bernoulli and gaussion distribution generators. |
| |
| //begin: the open sourced random generator from DE Shaw Research |
| //https://www.deshawresearch.com/resources_random123.html |
| typedef uint uint32_t; |
| |
| struct r123array4x32 { |
| uint32_t v[4]; |
| }; |
| |
| enum r123_enum_threefry32x4 { |
| R_32x4_0_0 = 10, |
| R_32x4_0_1 = 26, |
| R_32x4_1_0 = 11, |
| R_32x4_1_1 = 21, |
| R_32x4_2_0 = 13, |
| R_32x4_2_1 = 27, |
| R_32x4_3_0 = 23, |
| R_32x4_3_1 = 5, |
| R_32x4_4_0 = 6, |
| R_32x4_4_1 = 20, |
| R_32x4_5_0 = 17, |
| R_32x4_5_1 = 11, |
| R_32x4_6_0 = 25, |
| R_32x4_6_1 = 10, |
| R_32x4_7_0 = 18, |
| R_32x4_7_1 = 20 |
| }; |
| |
| inline uint32_t RotL_32(uint32_t x, unsigned int N) { |
| return (x << (N & 31)) | (x >> ((32 - N) & 31)); |
| } |
| |
| typedef struct r123array4x32 threefry4x32_ctr_t; |
| typedef struct r123array4x32 threefry4x32_key_t; |
| typedef struct r123array4x32 threefry4x32_ukey_t; |
| |
| inline threefry4x32_ctr_t threefry4x32_R(unsigned int Nrounds, threefry4x32_ctr_t in, threefry4x32_key_t k) { |
| threefry4x32_ctr_t X; |
| uint32_t ks[4 + 1]; |
| int i; |
| ks[4] = 0x1BD11BDA; |
| |
| { |
| ks[0] = k.v[0]; |
| X.v[0] = in.v[0]; |
| |
| ======================================================================= |
| ==./src/python/swig/numpy.i |
| ======================================================================= |
| /* -*- C -*- (not really, but good for syntax highlighting) */ |
| |
| /* |
| * Copyright (c) 2005-2015, NumPy Developers. |
| * All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are |
| * met: |
| * |
| * * Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * |
| * * Redistributions in binary form must reproduce the above |
| * copyright notice, this list of conditions and the following |
| * disclaimer in the documentation and/or other materials provided |
| * with the distribution. |
| * |
| * * Neither the name of the NumPy Developers nor the names of any |
| * contributors may be used to endorse or promote products derived |
| * from this software without specific prior written permission. |
| * |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| |
| #ifdef SWIGPYTHON |
| |
| %{ |
| #ifndef SWIG_FILE_WITH_INIT |
| #define NO_IMPORT_ARRAY |
| #endif |
| #include "stdio.h" |
| #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION |
| #include <numpy/arrayobject.h> |
| %} |
| |
| /**********************************************************************/ |
| |
| %fragment("NumPy_Backward_Compatibility", "header") |
| { |
| |
| ======================================================================= |
| ==./test/gtest/gtest-all.cc |
| ======================================================================= |
| // Copyright 2008, Google Inc. |
| // All rights reserved. |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are |
| // met: |
| // |
| // * Redistributions of source code must retain the above copyright |
| // notice, this list of conditions and the following disclaimer. |
| // * Redistributions in binary form must reproduce the above |
| // copyright notice, this list of conditions and the following disclaimer |
| // in the documentation and/or other materials provided with the |
| // distribution. |
| // * Neither the name of Google Inc. nor the names of its |
| // contributors may be used to endorse or promote products derived from |
| // this software without specific prior written permission. |
| // |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| // |
| // Author: mheule@google.com (Markus Heule) |
| // |
| // Google C++ Testing Framework (Google Test) |
| // |
| // Sometimes it's desirable to build Google Test by compiling a single file. |
| // This file serves this purpose. |
| |
| // This line ensures that gtest.h can be compiled on its own, even |
| // when it's fused. |
| #include "gtest/gtest.h" |
| |
| // The following lines pull in the real gtest *.cc files. |
| // Copyright 2005, Google Inc. |
| // All rights reserved. |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are |
| // met: |
| // |
| // * Redistributions of source code must retain the above copyright |
| // notice, this list of conditions and the following disclaimer. |
| |
| ======================================================================= |
| ==./test/gtest/gtest.h |
| ======================================================================= |
| // Copyright 2005, Google Inc. |
| // All rights reserved. |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are |
| // met: |
| // |
| // * Redistributions of source code must retain the above copyright |
| // notice, this list of conditions and the following disclaimer. |
| // * Redistributions in binary form must reproduce the above |
| // copyright notice, this list of conditions and the following disclaimer |
| // in the documentation and/or other materials provided with the |
| // distribution. |
| // * Neither the name of Google Inc. nor the names of its |
| // contributors may be used to endorse or promote products derived from |
| // this software without specific prior written permission. |
| // |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| // |
| // Author: wan@google.com (Zhanyong Wan) |
| // |
| // The Google C++ Testing Framework (Google Test) |
| // |
| // This header file defines the public API for Google Test. It should be |
| // included by any test program that uses Google Test. |
| // |
| // IMPORTANT NOTE: Due to limitation of the C++ language, we have to |
| // leave some internal implementation details in this header file. |
| // They are clearly marked by comments like this: |
| // |
| // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. |
| // |
| // Such code is NOT meant to be used by a user directly, and is subject |
| // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user |
| // program! |
| // |
| // Acknowledgment: Google Test borrowed the idea of automatic test |
| // registration from Barthelemy Dagenais' (barthelemy@prologique.com) |
| // easyUnit framework. |
| |
| |
| ======================================================================= |
| ==./test/gtest/gtest_main.cc |
| ======================================================================= |
| // Copyright 2006, Google Inc. |
| // All rights reserved. |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are |
| // met: |
| // |
| // * Redistributions of source code must retain the above copyright |
| // notice, this list of conditions and the following disclaimer. |
| // * Redistributions in binary form must reproduce the above |
| // copyright notice, this list of conditions and the following disclaimer |
| // in the documentation and/or other materials provided with the |
| // distribution. |
| // * Neither the name of Google Inc. nor the names of its |
| // contributors may be used to endorse or promote products derived from |
| // this software without specific prior written permission. |
| // |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| #include <stdio.h> |
| |
| #include "gtest/gtest.h" |
| |
| GTEST_API_ int main(int argc, char **argv) { |
| printf("Running main() from gtest_main.cc\n"); |
| testing::InitGoogleTest(&argc, argv); |
| return RUN_ALL_TESTS(); |
| } |
| |
| ======================================================================= |
| ==./tool/cpplint.py |
| ======================================================================= |
| #!/usr/bin/env python |
| # |
| # Copyright (c) 2009 Google Inc. All rights reserved. |
| # |
| # Redistribution and use in source and binary forms, with or without |
| # modification, are permitted provided that the following conditions are |
| # met: |
| # |
| # * Redistributions of source code must retain the above copyright |
| # notice, this list of conditions and the following disclaimer. |
| # * Redistributions in binary form must reproduce the above |
| # copyright notice, this list of conditions and the following disclaimer |
| # in the documentation and/or other materials provided with the |
| # distribution. |
| # * Neither the name of Google Inc. nor the names of its |
| # contributors may be used to endorse or promote products derived from |
| # this software without specific prior written permission. |
| # |
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| """Does google-lint on c++ files. |
| |
| The goal of this script is to identify places in the code that *may* |
| be in non-compliance with google style. It does not attempt to fix |
| up these problems -- the point is to educate. It does also not |
| attempt to find all problems, or to ensure that everything it does |
| find is legitimately a problem. |
| |
| In particular, we can get very confused by /* and // inside strings! |
| We do a small hack, which is to ignore //'s with "'s after them on the |
| same line, but it is far from perfect (in either direction). |
| """ |
| |
| import codecs |
| import copy |
| import getopt |
| import math # for log |
| import os |
| import re |
| import sre_compile |