CUDA_cublas_device_LIBRARY (ADVANCED);error:iota is not a member of std;caffe编译

一、

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cublas_device_LIBRARY (ADVANCED)
    linked by target "lidar_apollo_cnn_seg_detect" in directory /home/autoware/shared_dir/ros_pp/src/lidar_apollo_cnn_seg_detect


1.改变cmake版本

2。这个cmake版本的选择跟cuda版本有关。

3。目前已经改过两个版本

cuda10 可以用cmake-3.14.3

cuda10.2 可以用cmake-3.17

4。关于ros下面使用sudo apt autoremove cmake 会连带把ros好多包都卸掉。

  4.1 下载新版本并安装  

./bootstrap && make && sudo make install     

默认安装在/usr/local/share/

 4.2  删掉cmake原来的版本文件   就直接 sudo rm -r cmake-3.10

4.3 查看cmake --version

可能会显示

CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.10
cmake version 3.10

在终端输入 hash -r。应该就正确了。

二、

error:iota is not a member of std

说需要在cmakelists.txt添加

add_compile_options(-std=c++11)

不管用。

经查找发现缺乏头文件

#include <numeric>

就对了。

三、

caffe的安装

1。下载源码

2。

git clone https://github.com/BVLC/caffe
cd caffe
make all
make test
make runtest

3.先安装依赖库

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler 
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler libatlas-base-dev
sudo apt-get install python-dev python-pip gfortran

4.make all 之前呢,需要根据自己需求对Makefile.config进行更改。

我的需求,gpu、cudnn、opencv。所以,进行了如下更改。

cp Makefile.config.example Makefile.config
针对makefile.config
1。如果需要使用cudnn,把注释去掉。
USE_CUDNN := 1

2。如果使用opencv且版本为3,则去掉注释。
OPENCV_VERSION := 3

3。根据cuda版本号,添加注释。比如我的是cuda10>cuda9,则删掉20,21。
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := 
                #-gencode arch=compute_20,code=sm_20 \
		#-gencode arch=compute_20,code=sm_21 \
		-gencode arch=compute_30,code=sm_30 \
		-gencode arch=compute_35,code=sm_35 \
		-gencode arch=compute_50,code=sm_50 \
		-gencode arch=compute_52,code=sm_52 \
		-gencode arch=compute_60,code=sm_60 \
		-gencode arch=compute_61,code=sm_61 \
		-gencode arch=compute_61,code=compute_61

4。把INCLUDE_DIRS、LIBRARY_DIR用以下两行代码进行替换,其实就是添加了hdf5的路径。
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial  

5。更改makefile里的地方。Attention,PLEASE!
把181行改成如下:也就是解决hdf5找不到的问题。
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

5.在caffe路径下

make distribute

6.使用,在cmakelists.txt中

set(CAFFE_PATH "$ENV{HOME}/shared_dir/caffe/distribute")  #distribute路径

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这段代码是使用C++的std::iota函数来填充一个范围内的值。std::iota函数的作用是将一个范围内的元素按顺序递增填充为给定的初始值。在这个例子中,std::iota函数被用来将容器p中的元素从0开始递增填充。具体的实现可以参考以下代码: ```cpp template<class ForwardIterator, class T> void iota(ForwardIterator first, ForwardIterator last, T value) { while(first != last) { *first++ = value; ++value; } } ``` 这个函数接受三个参数:first和last是表示范围的迭代器,value是初始值。函数会从first开始,逐个将value赋值给范围内的元素,并将value递增。最后,范围内的元素将被填充为从value开始的递增序列。\[1\] 在C++11及以后的版本中,std::iota函数的声明稍有不同,但功能相同。\[2\] 等价操作可以表示为:*(d_first) = value; *(d_first+1) = ++value; *(d_first+2) = ++value; *(d_first+3) = ++value; ... 这里的d_first表示范围的起始位置,value表示初始值,++value表示递增的操作。\[3\] #### 引用[.reference_title] - *1* *2* *3* [C++11标准模板(STL)- 算法 - 数值运算(std::iota)](https://blog.csdn.net/qq_40788199/article/details/128361523)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值