diff options
author | Eric Tzeng <eric.s.tzeng@gmail.com> | 2014-02-27 16:08:16 -0800 |
---|---|---|
committer | Eric Tzeng <eric.s.tzeng@gmail.com> | 2014-03-13 14:30:44 -0700 |
commit | 8bc83b07dbb5548aa73c55a21596ce35f2a9b141 (patch) | |
tree | 35562afaa464bc8f936981d9e1c6999c02ef2f2f /src/caffe/test/test_caffe_main.cpp | |
parent | 04d6595d3c5995999675bbf1abb59b5f5305a2ec (diff) | |
download | caffeonacl-8bc83b07dbb5548aa73c55a21596ce35f2a9b141.tar.gz caffeonacl-8bc83b07dbb5548aa73c55a21596ce35f2a9b141.tar.bz2 caffeonacl-8bc83b07dbb5548aa73c55a21596ce35f2a9b141.zip |
Compile a binary to run all tests at once.
Diffstat (limited to 'src/caffe/test/test_caffe_main.cpp')
-rw-r--r-- | src/caffe/test/test_caffe_main.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/caffe/test/test_caffe_main.cpp b/src/caffe/test/test_caffe_main.cpp new file mode 100644 index 00000000..4674bb4e --- /dev/null +++ b/src/caffe/test/test_caffe_main.cpp @@ -0,0 +1,32 @@ +// Copyright 2013 Yangqing Jia + +// The main caffe test code. Your test cpp code should include this hpp +// to allow a main function to be compiled into the binary. + +#include "test_caffe_main.hpp" + +namespace caffe { + cudaDeviceProp CAFFE_TEST_CUDA_PROP; +} + +using caffe::CAFFE_TEST_CUDA_PROP; + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ::google::InitGoogleLogging(argv[0]); + // Before starting testing, let's first print out a few cuda defice info. + int device; + cudaGetDeviceCount(&device); + cout << "Cuda number of devices: " << device << endl; + if (argc > 1) { + // Use the given device + device = atoi(argv[1]); + cudaSetDevice(device); + cout << "Setting to use device " << device << endl; + } + cudaGetDevice(&device); + cout << "Current device id: " << device << endl; + cudaGetDeviceProperties(&CAFFE_TEST_CUDA_PROP, device); + // invoke the test. + return RUN_ALL_TESTS(); +} |