1/先安装git -window 版本
cmd 命令 到你自己的目录。
git clone --recursive https://github.com/caffe2/caffe2.git
git只能 命令行,没办法免费的,就将就吧。
这样下来的肯定是编译不过的。这个坑足够大,大到你的跪了。这个情况下,主要是 third_party目录是空的。从git运行命令看,运行了xxx分钟,各种third库看上去都进度100%实际看,目录为空的。这是谁在来逗我玩了?(是老天派来逗我的)。
修复:
将命令:git clone https://github.com/ARM-software/ComputeLibrary.git
git clone https://github.com/Maratyszcza/FP16.git
git clone https://github.com/Maratyszcza/FXdiv.git
git clone https://github.com/Maratyszcza/NNPACK.git
git clone https://github.com/zdevito/aten
git clone https://github.com/google/benchmark.git
git clone https://github.com/Maratyszcza/cpuinfo.git
git clone https://github.com/NVlabs/cub.git
git clone https://github.com/RLovelett/eigen.git
git clone https://github.com/facebookincubator/gloo
git clone https://github.com/google/googletest.git
git clone https://github.com/Yangqing/ios-cmake.git
git clone https://github.com/nvidia/nccl.git
git clone https://github.com/NervanaSystems/nervanagpu.git
git clone https://github.com/onnx/onnx.git
git clone https://github.com/google/protobuf.git
git clone https://github.com/Maratyszcza/psimd.git
git clone https://github.com/Maratyszcza/pthreadpool.git
git clone https://github.com/pybind/pybind11.git
git clone https://github.com/PeachPy/enum34.git
git clone https://github.com/Maratyszcza/PeachPy.git
git clone https://github.com/benjaminp/six.git
git clone https://github.com/facebook/zstd.git
保存到caffe2\third_party 目录 third_party.bat文件。再cmd 中 cd到 caffe2\third_party目录,执行 caffe2\third_partythird_party.bat,这下进度有,文件也有了。 如果eigen 没有,可以到baidu 到官网下载。
2、回到caffe2\scripts目录,执行,build_windows.bat . 这样会在 caffe2\build目录生成 .sln文件 这样可以vs编译。
3、不过话到这里,还是有坑。默认生成是lib静态库。debug会有大于2G,release 也有300M以上。老天,再次要来逗乐?
4、可以通过cmake 打开 这个build目录。选中一个选项,build_shared_libs, 这样再点击生成工程。工程中就是 dll 属性了。
不过目前这样仍然编译不过。稍等后续修复再补上。
这编译就是一个蛛丝一样,来回穿插的感觉。。。有没有爽到要死?
5: 修改如下内容。可以编译。但是链接,失败,提示库超过65535个对象。看来要dll走过去不太可能了。
include\unistd.h 文件补充
并定义#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
2
\cpuinfo\src\log.h
#ifdef _WIN32
#define CLOG_DEFINE_LOG_DEBUG
#define CLOG_DEFINE_LOG_INFO
#define CLOG_DEFINE_LOG_WARNING
#define CLOG_DEFINE_LOG_ERROR
#define CLOG_DEFINE_LOG_FATAL
#endif
#ifdef _WIN32
#else
CLOG_DEFINE_LOG_DEBUG(cpuinfo_, "cpuinfo", CPUINFO_LOG_LEVEL);
CLOG_DEFINE_LOG_INFO(cpuinfo_, "cpuinfo", CPUINFO_LOG_LEVEL);
CLOG_DEFINE_LOG_WARNING(cpuinfo_, "cpuinfo", CPUINFO_LOG_LEVEL);
CLOG_DEFINE_LOG_ERROR(cpuinfo_, "cpuinfo", CPUINFO_LOG_LEVEL);
CLOG_DEFINE_LOG_FATAL(cpuinfo_, "cpuinfo", CPUINFO_LOG_LEVEL);
#endif
3 project 属性 警告视为错误 修改为否
4 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”
是因入库为 debug 当前为release
2018-6-23 结论: 虽然可以编译通过。但是使用demo 有各种坑。不太适合应用生产环境。毕竟才一年多,不如caffe使用广泛了, 路还很长。 目前移步tensorflow。 没有开始选择 TF的原因是,它以前表现都是垫底。caffe远远排在前面。这两年 TF性能的各方面已经迎头赶上,排名 性能等都排在一二,而且持续研发迭代很多年。现对坑会少。
不过TF编译也有一些坑。经过几天折腾,还是正常编译,而且可以运行简单的 c++demo。 c++的demo相对少,大部分都是臭的不行的python的 例子。
后面再贴出TF的文章。