diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..1ff0c423 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index 53c1fb05..15165e7f 100644 --- a/.gitignore +++ b/.gitignore @@ -93,3 +93,11 @@ LOCK LOG* CURRENT MANIFEST-* + +#Visual Studio files +*.user +*.suo +*.sdf +*.opensdf +*.pdb +*.props \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..235cc83d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,19 @@ +version: 1.0.{build} +clone_folder: c:\projects\caffe +build_script: +- cmd: >- + cd C:\projects\caffe\windows + + copy CommonSettings.props.example CommonSettings.props + + nuget restore Caffe.sln -PackagesDirectory ..\..\NugetPackages -ConfigFile nuget.config + + set PATH=%PATH:nuget=hello% + + msbuild Caffe.sln /m /v:m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Configuration=Debug;CpuOnlyBuild=true;UseCuDNN=false + + msbuild Caffe.sln /m /v:m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Configuration=Release;CpuOnlyBuild=true;UseCuDNN=false + + cd .. + + Build\x64\Release\test_all.exe --gtest_filter=-*TestTimer* \ No newline at end of file diff --git a/include/caffe/test/test_caffe_main.hpp b/include/caffe/test/test_caffe_main.hpp index fc156091..12e6d797 100644 --- a/include/caffe/test/test_caffe_main.hpp +++ b/include/caffe/test/test_caffe_main.hpp @@ -10,6 +10,7 @@ #include #include "caffe/common.hpp" +#include "caffe/util/io.hpp" using std::cout; using std::endl; @@ -35,7 +36,8 @@ class MultiDeviceTest : public ::testing::Test { MultiDeviceTest() { Caffe::set_mode(TypeParam::device); } - virtual ~MultiDeviceTest() {} + // Caffe tests may create some temporary files, here we will do the cleanup. + virtual ~MultiDeviceTest() { RemoveCaffeTempDir(); } }; typedef ::testing::Types TestDtypes; diff --git a/include/caffe/util/cudnn.hpp b/include/caffe/util/cudnn.hpp index 8a7e17c6..a1e8ff4d 100644 --- a/include/caffe/util/cudnn.hpp +++ b/include/caffe/util/cudnn.hpp @@ -17,6 +17,7 @@ << cudnnGetErrorString(status); \ } while (0) +#if !defined (_MSC_VER) inline const char* cudnnGetErrorString(cudnnStatus_t status) { switch (status) { case CUDNN_STATUS_SUCCESS: @@ -44,6 +45,7 @@ inline const char* cudnnGetErrorString(cudnnStatus_t status) { } return "Unknown cudnn status"; } +#endif namespace caffe { diff --git a/include/caffe/util/io.hpp b/include/caffe/util/io.hpp index 1a599883..6375a4e3 100644 --- a/include/caffe/util/io.hpp +++ b/include/caffe/util/io.hpp @@ -23,8 +23,12 @@ using ::boost::filesystem::path; inline void MakeTempDir(string* temp_dirname) { temp_dirname->clear(); - const path& model = - boost::filesystem::temp_directory_path()/"caffe_test.%%%%-%%%%"; + // Place all temp directories under temp_root, to be able to delete all of + // them at once, without knowing their name. + const path& temp_root = + boost::filesystem::temp_directory_path() / "caffe_test"; + boost::filesystem::create_directory(temp_root); + const path& model = temp_root / "%%%%-%%%%"; for ( int i = 0; i < CAFFE_TMP_DIR_RETRIES; i++ ) { const path& dir = boost::filesystem::unique_path(model).string(); bool done = boost::filesystem::create_directory(dir); @@ -37,7 +41,7 @@ inline void MakeTempDir(string* temp_dirname) { } inline void MakeTempFilename(string* temp_filename) { - static path temp_files_subpath; + path temp_files_subpath; static uint64_t next_temp_file = 0; temp_filename->clear(); if ( temp_files_subpath.empty() ) { @@ -49,6 +53,21 @@ inline void MakeTempFilename(string* temp_filename) { (temp_files_subpath/caffe::format_int(next_temp_file++, 9)).string(); } +#ifdef _MSC_VER + +inline void RemoveCaffeTempDir() { + boost::system::error_code err; + boost::filesystem::remove_all( + boost::filesystem::temp_directory_path() / "caffe_test", err); +} + +#else + +inline void RemoveCaffeTempDir() { +} + +#endif + bool ReadProtoFromTextFile(const char* filename, Message* proto); inline bool ReadProtoFromTextFile(const string& filename, Message* proto) { diff --git a/python/caffe/test/test_python_layer.py b/python/caffe/test/test_python_layer.py index e46b7118..5669451f 100644 --- a/python/caffe/test/test_python_layer.py +++ b/python/caffe/test/test_python_layer.py @@ -131,6 +131,10 @@ class TestPythonLayer(unittest.TestCase): self.assertEqual(layer.blobs[0].data[0], -1) net.copy_from(caffemodel_file) self.assertEqual(layer.blobs[0].data[0], 1) + if os.name == 'nt': + # On Windows, attempting to remove a file that is in use + # causes an exception to be raised." + os.close(h) os.remove(caffemodel_file) # Test weight sharing diff --git a/python/caffe/test/test_solver.py b/python/caffe/test/test_solver.py index f618fded..4c1f0966 100644 --- a/python/caffe/test/test_solver.py +++ b/python/caffe/test/test_solver.py @@ -13,7 +13,10 @@ class TestSolver(unittest.TestCase): self.num_output = 13 net_f = simple_net_file(self.num_output) f = tempfile.NamedTemporaryFile(mode='w+', delete=False) - f.write("""net: '""" + net_f + """' + net_f_mod = net_f + if os.name == 'nt': + net_f_mod = net_f_mod.replace("\\", "/") + f.write("""net: '""" + net_f_mod + """' test_iter: 10 test_interval: 10 base_lr: 0.01 momentum: 0.9 weight_decay: 0.0005 lr_policy: 'inv' gamma: 0.0001 power: 0.75 display: 100 max_iter: 100 snapshot_after_train: false diff --git a/src/caffe/common.cpp b/src/caffe/common.cpp index 299d67d4..cab406fb 100644 --- a/src/caffe/common.cpp +++ b/src/caffe/common.cpp @@ -1,3 +1,8 @@ +#if defined(_MSC_VER) +#include +#define getpid() _getpid() +#endif + #include #include #include @@ -46,7 +51,11 @@ void GlobalInit(int* pargc, char*** pargv) { // Google logging. ::google::InitGoogleLogging(*(pargv)[0]); // Provide a backtrace on segfault. + + // Windows port of glogs doesn't have this function built +#if !defined(_MSC_VER) ::google::InstallFailureSignalHandler(); +#endif } #ifdef CPU_ONLY // CPU-only Caffe. diff --git a/src/caffe/layers/bnll_layer.cu b/src/caffe/layers/bnll_layer.cu index 8df8ef09..768a92bb 100644 --- a/src/caffe/layers/bnll_layer.cu +++ b/src/caffe/layers/bnll_layer.cu @@ -5,7 +5,7 @@ namespace caffe { -const float kBNLL_THRESHOLD = 50.; +__constant__ float kBNLL_THRESHOLD = 50.; template __global__ void BNLLForward(const int n, const Dtype* in, Dtype* out) { diff --git a/src/caffe/test/test_blob.cpp b/src/caffe/test/test_blob.cpp index a9d7d519..4e231cde 100644 --- a/src/caffe/test/test_blob.cpp +++ b/src/caffe/test/test_blob.cpp @@ -35,12 +35,14 @@ TYPED_TEST(BlobSimpleTest, TestInitialization) { EXPECT_EQ(this->blob_->count(), 0); } +#if !defined(CPU_ONLY) TYPED_TEST(BlobSimpleTest, TestPointersCPUGPU) { EXPECT_TRUE(this->blob_preshaped_->gpu_data()); EXPECT_TRUE(this->blob_preshaped_->cpu_data()); EXPECT_TRUE(this->blob_preshaped_->mutable_gpu_data()); EXPECT_TRUE(this->blob_preshaped_->mutable_cpu_data()); } +#endif TYPED_TEST(BlobSimpleTest, TestReshape) { this->blob_->Reshape(2, 3, 4, 5); diff --git a/src/caffe/test/test_gradient_based_solver.cpp b/src/caffe/test/test_gradient_based_solver.cpp index 84c6747f..e1dac742 100644 --- a/src/caffe/test/test_gradient_based_solver.cpp +++ b/src/caffe/test/test_gradient_based_solver.cpp @@ -177,6 +177,9 @@ class GradientBasedSolverTest : public MultiDeviceTest { proto << "momentum: " << momentum << " "; } MakeTempDir(&snapshot_prefix_); +#if defined(_MSC_VER) + std::replace(snapshot_prefix_.begin(), snapshot_prefix_.end(), '\\', '/'); +#endif proto << "snapshot_prefix: '" << snapshot_prefix_ << "/' "; if (snapshot) { proto << "snapshot: " << num_iters << " "; @@ -508,9 +511,8 @@ class GradientBasedSolverTest : public MultiDeviceTest { for (int i = 0; i < orig_params.size(); ++i) { param_copies[i].reset(new Blob()); const bool kReshape = true; - for (int copy_diff = false; copy_diff <= true; ++copy_diff) { - param_copies[i]->CopyFrom(*orig_params[i], copy_diff, kReshape); - } + param_copies[i]->CopyFrom(*orig_params[i], false/*copy data*/, kReshape); + param_copies[i]->CopyFrom(*orig_params[i], true/*copy diff*/, kReshape); } // Save the solver history @@ -520,9 +522,10 @@ class GradientBasedSolverTest : public MultiDeviceTest { for (int i = 0; i < orig_history.size(); ++i) { history_copies[i].reset(new Blob()); const bool kReshape = true; - for (int copy_diff = false; copy_diff <= true; ++copy_diff) { - history_copies[i]->CopyFrom(*orig_history[i], copy_diff, kReshape); - } + history_copies[i]->CopyFrom(*orig_history[i], + false/*copy data*/, kReshape); + history_copies[i]->CopyFrom(*orig_history[i], + true/*copy diff*/, kReshape); } // Run the solver for num_iters iterations and snapshot. diff --git a/src/caffe/test/test_lrn_layer.cpp b/src/caffe/test/test_lrn_layer.cpp index 4c97b1ae..23b52469 100644 --- a/src/caffe/test/test_lrn_layer.cpp +++ b/src/caffe/test/test_lrn_layer.cpp @@ -279,11 +279,10 @@ class CuDNNLRNLayerTest : public GPUDeviceTest { vector*> blob_top_vec_; }; -template -void CuDNNLRNLayerTest::ReferenceLRNForward( - const Blob& blob_bottom, const LayerParameter& layer_param, - Blob* blob_top) { - typedef TypeParam Dtype; +template +void CuDNNLRNLayerTest::ReferenceLRNForward( + const Blob& blob_bottom, const LayerParameter& layer_param, + Blob* blob_top) { blob_top->Reshape(blob_bottom.num(), blob_bottom.channels(), blob_bottom.height(), blob_bottom.width()); Dtype* top_data = blob_top->mutable_cpu_data(); diff --git a/src/caffe/util/db_lmdb.cpp b/src/caffe/util/db_lmdb.cpp index 0bc82b53..cd174479 100644 --- a/src/caffe/util/db_lmdb.cpp +++ b/src/caffe/util/db_lmdb.cpp @@ -1,13 +1,27 @@ #ifdef USE_LMDB #include "caffe/util/db_lmdb.hpp" +#if defined(_MSC_VER) +#include +#define mkdir(X, Y) _mkdir(X) +#endif + #include #include namespace caffe { namespace db { +#ifdef _MSC_VER +// On Windows lmdb creates file with the full size causing test failures due +// to insufficient disk space. We will reduce lmdb size to make tests pass. +const size_t LMDB_MAP_SIZE = 104857600; // 100 MB +// Constant will overflow on 32-bit build, assert that we are using correct +// build. +static_assert(sizeof(size_t) >= 8, "LMDB size overflow."); +#else const size_t LMDB_MAP_SIZE = 1099511627776; // 1 TB +#endif void LMDB::Open(const string& source, Mode mode) { MDB_CHECK(mdb_env_create(&mdb_env_)); diff --git a/src/caffe/util/hdf5.cpp b/src/caffe/util/hdf5.cpp index 7730e76a..051c9b20 100644 --- a/src/caffe/util/hdf5.cpp +++ b/src/caffe/util/hdf5.cpp @@ -29,31 +29,58 @@ void hdf5_load_nd_dataset_helper( CHECK_GE(status, 0) << "Failed to get dataset info for " << dataset_name_; switch (class_) { case H5T_FLOAT: - LOG_FIRST_N(INFO, 1) << "Datatype class: H5T_FLOAT"; - break; + // In VC++ declaring and initializing variables in case statement without + // curly braces (new scope), cause compiler error C2360 + // https://msdn.microsoft.com/en-us/library/61af7cx3.aspx + { + LOG_FIRST_N(INFO, 1) << "Datatype class: H5T_FLOAT"; + break; + } case H5T_INTEGER: - LOG_FIRST_N(INFO, 1) << "Datatype class: H5T_INTEGER"; - break; + { + LOG_FIRST_N(INFO, 1) << "Datatype class: H5T_INTEGER"; + break; + } case H5T_TIME: - LOG(FATAL) << "Unsupported datatype class: H5T_TIME"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_TIME"; + } case H5T_STRING: - LOG(FATAL) << "Unsupported datatype class: H5T_STRING"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_STRING"; + } case H5T_BITFIELD: - LOG(FATAL) << "Unsupported datatype class: H5T_BITFIELD"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_BITFIELD"; + } case H5T_OPAQUE: - LOG(FATAL) << "Unsupported datatype class: H5T_OPAQUE"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_OPAQUE"; + } case H5T_COMPOUND: - LOG(FATAL) << "Unsupported datatype class: H5T_COMPOUND"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_COMPOUND"; + } case H5T_REFERENCE: - LOG(FATAL) << "Unsupported datatype class: H5T_REFERENCE"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_REFERENCE"; + } case H5T_ENUM: - LOG(FATAL) << "Unsupported datatype class: H5T_ENUM"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_ENUM"; + } case H5T_VLEN: - LOG(FATAL) << "Unsupported datatype class: H5T_VLEN"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_VLEN"; + } case H5T_ARRAY: - LOG(FATAL) << "Unsupported datatype class: H5T_ARRAY"; + { + LOG(FATAL) << "Unsupported datatype class: H5T_ARRAY"; + } default: - LOG(FATAL) << "Datatype class unknown"; + { + LOG(FATAL) << "Datatype class unknown"; + } } vector blob_dims(dims.size()); diff --git a/src/caffe/util/io.cpp b/src/caffe/util/io.cpp index 835d2d4e..f679df81 100644 --- a/src/caffe/util/io.cpp +++ b/src/caffe/util/io.cpp @@ -1,4 +1,9 @@ #include + +#if defined(_MSC_VER) +#include +#endif + #include #include #include @@ -50,7 +55,11 @@ void WriteProtoToTextFile(const Message& proto, const char* filename) { } bool ReadProtoFromBinaryFile(const char* filename, Message* proto) { +#if defined (_MSC_VER) // for MSC compiler binary flag needs to be specified + int fd = open(filename, O_RDONLY | O_BINARY); +#else int fd = open(filename, O_RDONLY); +#endif CHECK_NE(fd, -1) << "File not found: " << filename; ZeroCopyInputStream* raw_input = new FileInputStream(fd); CodedInputStream* coded_input = new CodedInputStream(raw_input); diff --git a/tools/caffe.cpp b/tools/caffe.cpp index ebe95d61..7f8dc7d2 100644 --- a/tools/caffe.cpp +++ b/tools/caffe.cpp @@ -148,6 +148,7 @@ caffe::SolverAction::Enum GetRequestedAction( return caffe::SolverAction::NONE; } LOG(FATAL) << "Invalid signal effect \""<< flag_value << "\" was specified"; + return caffe::SolverAction::NONE; } // Train / Finetune a model. @@ -196,14 +197,19 @@ int train() { Caffe::set_solver_count(gpus.size()); } +#if !defined(_MSC_VER) + // Signals are not properly supported in Windows. caffe::SignalHandler signal_handler( GetRequestedAction(FLAGS_sigint_effect), GetRequestedAction(FLAGS_sighup_effect)); +#endif shared_ptr > solver(caffe::SolverRegistry::CreateSolver(solver_param)); +#if !defined(_MSC_VER) solver->SetActionFunction(signal_handler.GetActionFunction()); +#endif if (FLAGS_snapshot.size()) { LOG(INFO) << "Resuming from " << FLAGS_snapshot; diff --git a/windows/Caffe.sln b/windows/Caffe.sln new file mode 100644 index 00000000..9807327d --- /dev/null +++ b/windows/Caffe.sln @@ -0,0 +1,87 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcaffe", "libcaffe\libcaffe.vcxproj", "{A9ACEF83-7B63-4574-A554-89CE869EA141}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "caffe", "caffe\caffe.vcxproj", "{CE6BBC46-9EFC-4029-9065-85A023866AFB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compute_image_mean", "compute_image_mean\compute_image_mean.vcxproj", "{09A8EDAC-20B9-414F-9654-961388FD5A8C}" + ProjectSection(ProjectDependencies) = postProject + {CE6BBC46-9EFC-4029-9065-85A023866AFB} = {CE6BBC46-9EFC-4029-9065-85A023866AFB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convert_imageset", "convert_imageset\convert_imageset.vcxproj", "{44AAEF8E-2DF2-4534-AD6C-50017997897B}" + ProjectSection(ProjectDependencies) = postProject + {CE6BBC46-9EFC-4029-9065-85A023866AFB} = {CE6BBC46-9EFC-4029-9065-85A023866AFB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "extract_features", "extract_features\extract_features.vcxproj", "{C4A4173A-1BBA-4668-B506-0538A7D259E4}" + ProjectSection(ProjectDependencies) = postProject + {CE6BBC46-9EFC-4029-9065-85A023866AFB} = {CE6BBC46-9EFC-4029-9065-85A023866AFB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_all", "test_all\test_all.vcxproj", "{00BBA8C0-707D-42A7-82FF-D5211185ED7F}" + ProjectSection(ProjectDependencies) = postProject + {CE6BBC46-9EFC-4029-9065-85A023866AFB} = {CE6BBC46-9EFC-4029-9065-85A023866AFB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pycaffe", "pycaffe\pycaffe.vcxproj", "{38B6CE09-4B1A-4E72-A547-8A3299D8DA60}" + ProjectSection(ProjectDependencies) = postProject + {CE6BBC46-9EFC-4029-9065-85A023866AFB} = {CE6BBC46-9EFC-4029-9065-85A023866AFB} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "props", "props", "{632DD6E1-28DF-42F9-AD7F-1C1F2D38765C}" + ProjectSection(SolutionItems) = preProject + CommonSettings.props = CommonSettings.props + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{E2EF4AB6-AB52-4777-9783-4669A0D61F80}" + ProjectSection(SolutionItems) = preProject + scripts\BinplaceCudaDependencies.cmd = scripts\BinplaceCudaDependencies.cmd + scripts\FixGFlagsNaming.cmd = scripts\FixGFlagsNaming.cmd + scripts\ProtoCompile.cmd = scripts\ProtoCompile.cmd + scripts\PythonPostBuild.cmd = scripts\PythonPostBuild.cmd + scripts\PythonPreBuild.cmd = scripts\PythonPreBuild.cmd + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A9ACEF83-7B63-4574-A554-89CE869EA141}.Debug|x64.ActiveCfg = Debug|x64 + {A9ACEF83-7B63-4574-A554-89CE869EA141}.Debug|x64.Build.0 = Debug|x64 + {A9ACEF83-7B63-4574-A554-89CE869EA141}.Release|x64.ActiveCfg = Release|x64 + {A9ACEF83-7B63-4574-A554-89CE869EA141}.Release|x64.Build.0 = Release|x64 + {CE6BBC46-9EFC-4029-9065-85A023866AFB}.Debug|x64.ActiveCfg = Debug|x64 + {CE6BBC46-9EFC-4029-9065-85A023866AFB}.Debug|x64.Build.0 = Debug|x64 + {CE6BBC46-9EFC-4029-9065-85A023866AFB}.Release|x64.ActiveCfg = Release|x64 + {CE6BBC46-9EFC-4029-9065-85A023866AFB}.Release|x64.Build.0 = Release|x64 + {09A8EDAC-20B9-414F-9654-961388FD5A8C}.Debug|x64.ActiveCfg = Debug|x64 + {09A8EDAC-20B9-414F-9654-961388FD5A8C}.Debug|x64.Build.0 = Debug|x64 + {09A8EDAC-20B9-414F-9654-961388FD5A8C}.Release|x64.ActiveCfg = Release|x64 + {09A8EDAC-20B9-414F-9654-961388FD5A8C}.Release|x64.Build.0 = Release|x64 + {44AAEF8E-2DF2-4534-AD6C-50017997897B}.Debug|x64.ActiveCfg = Debug|x64 + {44AAEF8E-2DF2-4534-AD6C-50017997897B}.Debug|x64.Build.0 = Debug|x64 + {44AAEF8E-2DF2-4534-AD6C-50017997897B}.Release|x64.ActiveCfg = Release|x64 + {44AAEF8E-2DF2-4534-AD6C-50017997897B}.Release|x64.Build.0 = Release|x64 + {C4A4173A-1BBA-4668-B506-0538A7D259E4}.Debug|x64.ActiveCfg = Debug|x64 + {C4A4173A-1BBA-4668-B506-0538A7D259E4}.Debug|x64.Build.0 = Debug|x64 + {C4A4173A-1BBA-4668-B506-0538A7D259E4}.Release|x64.ActiveCfg = Release|x64 + {C4A4173A-1BBA-4668-B506-0538A7D259E4}.Release|x64.Build.0 = Release|x64 + {00BBA8C0-707D-42A7-82FF-D5211185ED7F}.Debug|x64.ActiveCfg = Debug|x64 + {00BBA8C0-707D-42A7-82FF-D5211185ED7F}.Debug|x64.Build.0 = Debug|x64 + {00BBA8C0-707D-42A7-82FF-D5211185ED7F}.Release|x64.ActiveCfg = Release|x64 + {00BBA8C0-707D-42A7-82FF-D5211185ED7F}.Release|x64.Build.0 = Release|x64 + {38B6CE09-4B1A-4E72-A547-8A3299D8DA60}.Debug|x64.ActiveCfg = Debug|x64 + {38B6CE09-4B1A-4E72-A547-8A3299D8DA60}.Debug|x64.Build.0 = Debug|x64 + {38B6CE09-4B1A-4E72-A547-8A3299D8DA60}.Release|x64.ActiveCfg = Release|x64 + {38B6CE09-4B1A-4E72-A547-8A3299D8DA60}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/windows/CommonSettings.props.example b/windows/CommonSettings.props.example new file mode 100644 index 00000000..f5b4f3a7 --- /dev/null +++ b/windows/CommonSettings.props.example @@ -0,0 +1,99 @@ + + + + + $(SolutionDir)..\Build + + false + true + 7.5 + + false + + + + compute_35,sm_35 + + + + $(SolutionDir)..\..\CaffeCuDnn + $(SolutionDir)\scripts + + + cublas.lib;cuda.lib;curand.lib;cudart.lib + + + cudnn.lib;$(CudaDependencies) + $(CuDnnPath)\cuda\lib\x64;$(LibraryPath) + $(CuDnnPath)\cuda\include;$(IncludePath) + + + $(BuildDir)\$(Platform)\$(Configuration)\ + $(BuildDir)\Int\$(ProjectName)\$(Platform)\$(Configuration)\ + + + $(OutDir);$(CUDA_PATH)\lib\$(Platform);$(LibraryPath) + $(SolutionDir)..\include;$(SolutionDir)..\include\caffe\proto;$(CUDA_PATH)\include;$(IncludePath) + + + C:\Miniconda2\ + $(PythonDir)\libs;$(LibraryPath) + $(PythonDir)\include;$(IncludePath) + + + + CPU_ONLY;%(PreprocessorDefinitions) + + + + + USE_CUDNN;%(PreprocessorDefinitions) + + + USE_CUDNN + + + + + WITH_PYTHON_LAYER;BOOST_PYTHON_STATIC_LIB;%(PreprocessorDefinitions) + + + + + false + true + _SCL_SECURE_NO_WARNINGS;USE_OPENCV;USE_LEVELDB;USE_LMDB;%(PreprocessorDefinitions) + true + + + + + Full + NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + true + true + UseLinkTimeCodeGeneration + true + + + + + Disabled + _DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + true + + + \ No newline at end of file diff --git a/windows/CommonSettings.targets b/windows/CommonSettings.targets new file mode 100644 index 00000000..b9077d35 --- /dev/null +++ b/windows/CommonSettings.targets @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/windows/caffe/caffe.vcxproj b/windows/caffe/caffe.vcxproj new file mode 100644 index 00000000..564dbbee --- /dev/null +++ b/windows/caffe/caffe.vcxproj @@ -0,0 +1,118 @@ + + + + + + + + Debug + x64 + + + Release + x64 + + + + {CE6BBC46-9EFC-4029-9065-85A023866AFB} + Win32Proj + x64 + caffe + e703126e + + + + Application + true + Unicode + v120 + + + Application + false + Unicode + v120 + + + + + + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + $(ScriptsDir)\FixGFlagsNaming.cmd "$(OutDir)" $(Configuration) + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + $(ScriptsDir)\FixGFlagsNaming.cmd "$(OutDir)" $(Configuration) + + + + + + + + {a9acef83-7b63-4574-a554-89ce869ea141} + false + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/caffe/packages.config b/windows/caffe/packages.config new file mode 100644 index 00000000..ff68ac18 --- /dev/null +++ b/windows/caffe/packages.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/compute_image_mean/compute_image_mean.vcxproj b/windows/compute_image_mean/compute_image_mean.vcxproj new file mode 100644 index 00000000..a41ec77b --- /dev/null +++ b/windows/compute_image_mean/compute_image_mean.vcxproj @@ -0,0 +1,112 @@ + + + + + + + + Debug + x64 + + + Release + x64 + + + + {09A8EDAC-20B9-414F-9654-961388FD5A8C} + Win32Proj + x64 + compute_image_mean + f6e60ad8 + + + + Application + true + Unicode + v120 + + + Application + false + Unicode + v120 + + + + + + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + + + + + + {a9acef83-7b63-4574-a554-89ce869ea141} + false + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/compute_image_mean/packages.config b/windows/compute_image_mean/packages.config new file mode 100644 index 00000000..ff68ac18 --- /dev/null +++ b/windows/compute_image_mean/packages.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/convert_imageset/convert_imageset.vcxproj b/windows/convert_imageset/convert_imageset.vcxproj new file mode 100644 index 00000000..7b91235d --- /dev/null +++ b/windows/convert_imageset/convert_imageset.vcxproj @@ -0,0 +1,112 @@ + + + + + + + + Debug + x64 + + + Release + x64 + + + + {44AAEF8E-2DF2-4534-AD6C-50017997897B} + Win32Proj + x64 + convert_imageset + aa5aeccc + + + + Application + true + Unicode + v120 + + + Application + false + Unicode + v120 + + + + + + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + + + + + + {a9acef83-7b63-4574-a554-89ce869ea141} + false + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/convert_imageset/packages.config b/windows/convert_imageset/packages.config new file mode 100644 index 00000000..ff68ac18 --- /dev/null +++ b/windows/convert_imageset/packages.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/extract_features/extract_features.vcxproj b/windows/extract_features/extract_features.vcxproj new file mode 100644 index 00000000..c251edf8 --- /dev/null +++ b/windows/extract_features/extract_features.vcxproj @@ -0,0 +1,118 @@ + + + + + + + + Debug + x64 + + + Release + x64 + + + + {C4A4173A-1BBA-4668-B506-0538A7D259E4} + Win32Proj + x64 + extract_features + 59a71837 + + + + Application + true + Unicode + v120 + + + Application + false + Unicode + v120 + + + + + + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + 4005 + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + 4005 + + + + + + + + {a9acef83-7b63-4574-a554-89ce869ea141} + false + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/extract_features/packages.config b/windows/extract_features/packages.config new file mode 100644 index 00000000..ff68ac18 --- /dev/null +++ b/windows/extract_features/packages.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/libcaffe/libcaffe.vcxproj b/windows/libcaffe/libcaffe.vcxproj new file mode 100644 index 00000000..6488ff0a --- /dev/null +++ b/windows/libcaffe/libcaffe.vcxproj @@ -0,0 +1,383 @@ + + + + + + + + + Debug + x64 + + + Release + x64 + + + + {A9ACEF83-7B63-4574-A554-89CE869EA141} + libcaffe + v120 + + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + b4efcc07 + + + + + + + + true + Console + + + "$(ScriptsDir)\ProtoCompile.cmd" "$(SolutionDir)" "$(ProtocDir)" + + + "$(ScriptsDir)\BinplaceCudaDependencies.cmd" "$(CudaToolkitBinDir)" "$(CuDnnPath)" $(CpuOnlyBuild) $(UseCuDNN) "$(OutDir)" + + + 64 + $(CudaArchitecture) + true + -Xcudafe "--diag_suppress=exception_spec_override_incompat --diag_suppress=useless_using_declaration --diag_suppress=field_without_dll_interface" -D_SCL_SECURE_NO_WARNINGS -DGFLAGS_DLL_DECL= + + + 4661;4005;4812;4715;%(DisableSpecificWarnings) + $(ProjectDir)\..\..\src\;%(AdditionalIncludeDirectories) + + + /ignore:4221 %(AdditionalOptions) + + + + + Console + + + "$(ScriptsDir)\ProtoCompile.cmd" "$(SolutionDir)" "$(ProtocDir)" + + + "$(ScriptsDir)\BinplaceCudaDependencies.cmd" "$(CudaToolkitBinDir)" "$(CuDnnPath)" $(CpuOnlyBuild) $(UseCuDNN) "$(OutDir)" + + + 64 + $(CudaArchitecture) + -Xcudafe "--diag_suppress=exception_spec_override_incompat --diag_suppress=useless_using_declaration --diag_suppress=field_without_dll_interface" -D_SCL_SECURE_NO_WARNINGS -DGFLAGS_DLL_DECL= + + + 4661;4005;4812;4715;%(DisableSpecificWarnings) + $(ProjectDir)\..\..\src\;%(AdditionalIncludeDirectories) + + + /ignore:4221 %(AdditionalOptions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/libcaffe/libcaffe.vcxproj.filters b/windows/libcaffe/libcaffe.vcxproj.filters new file mode 100644 index 00000000..ef71751c --- /dev/null +++ b/windows/libcaffe/libcaffe.vcxproj.filters @@ -0,0 +1,794 @@ + + + + + {253af030-e1e0-426c-9a22-6315b0d2dab7} + + + {36c36b62-e801-40f2-bba9-a79f09fa4dba} + + + {66b19093-f1ad-443e-b5d3-f55955ff0ae2} + + + {3be25bf1-cf46-47da-b1ff-30cb442da7c5} + + + {9e47fb53-4e3b-4e03-b677-a58cc26af7fb} + + + {bbb6f6f1-8a55-469b-8729-a61f87d6b63d} + + + {f9e33710-c82c-4808-90e7-96620a190b3c} + + + {9a64cba7-8bef-4df3-b933-adec019daadb} + + + {96fba2c6-dad0-4766-b354-08a7768d57d8} + + + {e4995612-1b91-40ea-9756-44382eddca40} + + + {c820c58e-d861-4d88-8b18-2180996d0657} + + + {f10cfd17-81b6-4a08-829d-1a1fa4769d2e} + + + {fcb8114c-3425-41da-b30a-af2cb33dd851} + + + + + src\util + + + src\util + + + src\util + + + src\util + + + src\util + + + src\util + + + src\proto + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src\util + + + src\util + + + src\util + + + src\util + + + src\util + + + src + + + src + + + src + + + src\util + + + src\solvers + + + src\solvers + + + src\solvers + + + src\solvers + + + src\solvers + + + src\solvers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + src\layers + + + + + include\proto + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\util + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include\layers + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include\layers + + + include\layers + + + include\layers + + + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\util + + + cu\util + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\layers + + + cu\solvers + + + cu\solvers + + + cu\solvers + + + cu\solvers + + + cu\solvers + + + cu\solvers + + + + + + \ No newline at end of file diff --git a/windows/libcaffe/packages.config b/windows/libcaffe/packages.config new file mode 100644 index 00000000..ab2d5ffa --- /dev/null +++ b/windows/libcaffe/packages.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/nuget.config b/windows/nuget.config new file mode 100644 index 00000000..fc77aae0 --- /dev/null +++ b/windows/nuget.config @@ -0,0 +1,4 @@ + + + ..\..\NugetPackages + \ No newline at end of file diff --git a/windows/pycaffe/packages.config b/windows/pycaffe/packages.config new file mode 100644 index 00000000..15803452 --- /dev/null +++ b/windows/pycaffe/packages.config @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/pycaffe/pycaffe.vcxproj b/windows/pycaffe/pycaffe.vcxproj new file mode 100644 index 00000000..e48a61cd --- /dev/null +++ b/windows/pycaffe/pycaffe.vcxproj @@ -0,0 +1,129 @@ + + + + + + + + + Debug + x64 + + + Release + x64 + + + + {38B6CE09-4B1A-4E72-A547-8A3299D8DA60} + pycaffe + + + + v120 + DynamicLibrary + + + + + + + + + .pyd + _caffe + + + $(PythonDir)\Lib\site-packages\numpy\core\include\;$(IncludePath) + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + + + + + 4003 + + + "$(ScriptsDir)\PythonPreBuild.cmd" "$(SolutionDir)" "$(ProtocDir)" "$(OutDir)" + + + "$(ScriptsDir)\PythonPostBuild.cmd" "$(SolutionDir)" "$(OutDir)" + + + + + + + + {a9acef83-7b63-4574-a554-89ce869ea141} + false + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + $(BuildDependsOn) + OriginalBuild;SkipBuild + 14b5f2c8 + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/scripts/BinplaceCudaDependencies.cmd b/windows/scripts/BinplaceCudaDependencies.cmd new file mode 100644 index 00000000..4f5b0e48 --- /dev/null +++ b/windows/scripts/BinplaceCudaDependencies.cmd @@ -0,0 +1,22 @@ +set CUDA_TOOLKIT_BIN_DIR=%~1% +set CUDNN_PATH=%~2% +set IS_CPU_ONLY_BUILD=%3% +set USE_CUDNN=%4% +set OUTPUT_DIR=%~5% + +if %IS_CPU_ONLY_BUILD% == true ( + echo BinplaceCudaDependencies : CPU only build, don't copy cuda dependencies. + ) else ( + echo BinplaceCudaDependencies : Copy cudart*.dll, cublas*dll, curand*.dll to output. + + copy /y "%CUDA_TOOLKIT_BIN_DIR%\cudart*.dll" "%OUTPUT_DIR%" + copy /y "%CUDA_TOOLKIT_BIN_DIR%\cublas*.dll" "%OUTPUT_DIR%" + copy /y "%CUDA_TOOLKIT_BIN_DIR%\curand*.dll" "%OUTPUT_DIR%" + + if %USE_CUDNN% == true ( + echo BinplaceCudaDependencies : Copy cunn*.dll to output. + copy /y "%CUDNN_PATH%\cuda\bin\cudnn*.dll" "%OUTPUT_DIR%" + ) else ( + echo BinplaceCudaDependencies : cuDNN isn't enabled. + ) +) \ No newline at end of file diff --git a/windows/scripts/FixGFlagsNaming.cmd b/windows/scripts/FixGFlagsNaming.cmd new file mode 100644 index 00000000..2dc11332 --- /dev/null +++ b/windows/scripts/FixGFlagsNaming.cmd @@ -0,0 +1,24 @@ +:: Glog nuget package has dependency on GFlags nuget package +:: Caffe also has direct dependency on GFlags +:: Unfortunately in GLog nuget package, dependency to GFlags dll was incorrectly set (naming is wrong) +:: For this reasons Caffe needs gflags.dll/gflagsd.dll in release/debug +:: and GLog needs libgflags.dll/libgflags-debug.dll in release/debug +:: This scripts is a workaround for this issue. + +set OUTPUT_DIR=%~1% +set BUILD_CONFIG=%2% + +if %BUILD_CONFIG% == Release ( + set originalDllName=gflags.dll + set newDllName=libgflags.dll +) else ( + set originalDllName=gflagsd.dll + set newDllName=libgflags-debug.dll +) + +if exist "%OUTPUT_DIR%\%newDllName%" ( + echo FixGFlagsNaming.cmd : "%newDllName%" already exists +) else ( + echo FixGFlagsNaming.cmd : mklink /H "%OUTPUT_DIR%\%newDllName%" "%OUTPUT_DIR%\%originalDllName%" + mklink /H "%OUTPUT_DIR%\%newDllName%" "%OUTPUT_DIR%\%originalDllName%" +) \ No newline at end of file diff --git a/windows/scripts/ProtoCompile.cmd b/windows/scripts/ProtoCompile.cmd new file mode 100644 index 00000000..d056e6a1 --- /dev/null +++ b/windows/scripts/ProtoCompile.cmd @@ -0,0 +1,27 @@ +set SOLUTION_DIR=%~1% +set PROTO_DIR=%~2% + +set INCLUDE_PROTO_DIR=%SOLUTION_DIR%..\include\caffe\proto +SET SRC_PROTO_DIR=%SOLUTION_DIR%..\src\caffe\proto +set PROTO_TEMP_DIR=%SRC_PROTO_DIR%\temp + +echo ProtoCompile.cmd : Create proto temp directory "%PROTO_TEMP_DIR%" +mkdir "%PROTO_TEMP_DIR%" + +echo ProtoCompile.cmd : Generating "%PROTO_TEMP_DIR%\caffe.pb.h" and "%PROTO_TEMP_DIR%\caffe.pb.cc" +"%PROTO_DIR%protoc" --proto_path="%SRC_PROTO_DIR%" --cpp_out="%PROTO_TEMP_DIR%" "%SRC_PROTO_DIR%\caffe.proto" + +echo ProtoCompile.cmd : Create proto include directory +mkdir "%INCLUDE_PROTO_DIR%" + +echo ProtoCompile.cmd : Compare newly compiled caffe.pb.h with existing one +fc /b "%PROTO_TEMP_DIR%\caffe.pb.h" "%INCLUDE_PROTO_DIR%\caffe.pb.h" > NUL + +if errorlevel 1 ( + echo ProtoCompile.cmd : Move newly generated caffe.pb.h to "%INCLUDE_PROTO_DIR%\caffe.pb.h" + echo ProtoCompile.cmd : and caffe.pb.cc to "%SRC_PROTO_DIR%\caffe.pb.cc" + move /y "%PROTO_TEMP_DIR%\caffe.pb.h" "%INCLUDE_PROTO_DIR%\caffe.pb.h" + move /y "%PROTO_TEMP_DIR%\caffe.pb.cc" "%SRC_PROTO_DIR%\caffe.pb.cc" +) + +rmdir /S /Q "%PROTO_TEMP_DIR%" \ No newline at end of file diff --git a/windows/scripts/PythonPostBuild.cmd b/windows/scripts/PythonPostBuild.cmd new file mode 100644 index 00000000..6eb3aa75 --- /dev/null +++ b/windows/scripts/PythonPostBuild.cmd @@ -0,0 +1,8 @@ +set SOLUTION_DIR=%~1% +set OUTPUT_DIR=%~2% + +echo PythonPostBuild.cmd : copy python generated scripts to output. + +copy /y "%SOLUTION_DIR%..\python\caffe\*.py" "%OUTPUT_DIR%pycaffe\caffe" +copy /y "%SOLUTION_DIR%..\python\*.py" "%OUTPUT_DIR%pycaffe" +move /y "%OUTPUT_DIR%_caffe.*" "%OUTPUT_DIR%pycaffe\caffe" \ No newline at end of file diff --git a/windows/scripts/PythonPreBuild.cmd b/windows/scripts/PythonPreBuild.cmd new file mode 100644 index 00000000..1f07b1d2 --- /dev/null +++ b/windows/scripts/PythonPreBuild.cmd @@ -0,0 +1,15 @@ +set SOLUTION_DIR=%~1% +set PROTO_COMPILER_DIR=%~2% +set OUTPUT_DIR=%~3% + +echo PythonPreBuild.cmd : Create output directories for python scripts. + +if not exist "%OUTPUT_DIR%\pycaffe" mkdir "%OUTPUT_DIR%\pycaffe" +if not exist "%OUTPUT_DIR%\pycaffe\caffe" mkdir "%OUTPUT_DIR%\pycaffe\caffe" +if not exist "%OUTPUT_DIR%\pycaffe\caffe\proto" mkdir "%OUTPUT_DIR%\pycaffe\caffe\proto" + +echo PythonPreBuild.cmd : Create dummy __init__.py file +rem. > "%OUTPUT_DIR%\pycaffe\caffe\proto\__init__.py" + +echo PythonPreBuild.cmd : Generating src\caffe\proto\caffe.pb.h with python bindings +"%PROTO_COMPILER_DIR%\protoc" "%SOLUTION_DIR%\..\src\caffe\proto\caffe.proto" --proto_path="%SOLUTION_DIR%\..\src\caffe\proto" --python_out="%OUTPUT_DIR%\pycaffe\caffe\proto" \ No newline at end of file diff --git a/windows/test_all/packages.config b/windows/test_all/packages.config new file mode 100644 index 00000000..ff68ac18 --- /dev/null +++ b/windows/test_all/packages.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/test_all/test_all.vcxproj b/windows/test_all/test_all.vcxproj new file mode 100644 index 00000000..aa3409a8 --- /dev/null +++ b/windows/test_all/test_all.vcxproj @@ -0,0 +1,207 @@ + + + + + + + + + Debug + x64 + + + Release + x64 + + + + {00BBA8C0-707D-42A7-82FF-D5211185ED7F} + Win32Proj + x64 + test_all + f6a28848 + + + + Application + true + Unicode + v120 + + + Application + false + Unicode + v120 + + + + + + + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + 4005;%(DisableSpecificWarnings) + $(ProjectDir)\..\..\src;%(AdditionalIncludeDirectories) + + + 64 + $(CudaArchitecture) + true + -Xcudafe "--diag_suppress=exception_spec_override_incompat --diag_suppress=useless_using_declaration --diag_suppress=field_without_dll_interface --diag_suppress=boolean_controlling_expr_is_constant" -D_SCL_SECURE_NO_WARNINGS -DGFLAGS_DLL_DECL= + + + + + libcaffe.lib;$(CudaDependencies);%(AdditionalDependencies) + Console + + + 4005;%(DisableSpecificWarnings) + $(ProjectDir)\..\..\src;%(AdditionalIncludeDirectories) + + + 64 + $(CudaArchitecture) + -Xcudafe "--diag_suppress=exception_spec_override_incompat --diag_suppress=useless_using_declaration --diag_suppress=field_without_dll_interface --diag_suppress=boolean_controlling_expr_is_constant" -D_SCL_SECURE_NO_WARNINGS -DGFLAGS_DLL_DECL= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Document + + + + + + + + + {a9acef83-7b63-4574-a554-89ce869ea141} + false + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/test_all/test_all.vcxproj.filters b/windows/test_all/test_all.vcxproj.filters new file mode 100644 index 00000000..1e2f107c --- /dev/null +++ b/windows/test_all/test_all.vcxproj.filters @@ -0,0 +1,232 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {46116906-a399-42c7-be9d-8a20cbbb0169} + + + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + + + include + + + include + + + + + + + + cu + + + \ No newline at end of file