1. 程式人生 > >Linux下GPU與CPU版本的caffe切換

Linux下GPU與CPU版本的caffe切換

前些日子在HPC cluster(高效能運算機群)上安裝好了GPU版本的caffe,最近N卡驅動出了問題,導致無法使用GPU版本的caffe進行資料的訓練,我只是個普通使用者,無法去解決這個問題,所以無奈將GPU版本修改為CPU版本勉強進行一些實驗,其實主要是對Makefile.config的配置做個修改,然後重新編譯一下。

下面是Makefile.config的相關配置

## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).
#USE_CUDNN := 1   #這裡在CPU版本需要註釋掉,GPU取消註釋
# CPU-only switch (uncomment to build without GPU support). CPU_ONLY := 1 #這裡CPU取消註釋,GPU版本需要註釋 # uncomment to disable IO dependencies and corresponding data layers # USE_OPENCV := 0 # USE_LEVELDB := 0 # USE_LMDB := 0 # uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary) # You should not set this flag if you will be reading LMDBs with any # possibility of simultaneous read and write # ALLOW_LMDB_NOLOCK := 1 # Uncomment if you're using OpenCV 3 # OPENCV_VERSION := 3 # To customize your choice of compiler, uncomment and set the following. # N.B. the default for Linux is g++ and the default for OSX is clang++ # CUSTOM_CXX := g++ # CUDA directory contains bin/ and lib/ directories that we need. # CUDA_DIR := /public/software/cuda-8.0 #這裡在CPU版本需要註釋掉,GPU取消註釋(根據實際情況配置好你的CUDA路徑)
# On Ubuntu 14.04, if cuda tools are installed via # "sudo apt-get install nvidia-cuda-toolkit" then use this instead: # CUDA_DIR := /usr # CUDA architecture setting: going with all of them. # For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility. # For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility. # CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \ #這裡CPU加上註釋,GPU取消註釋
-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 # BLAS choice: # atlas for ATLAS (default) # mkl for MKL # open for OpenBlas BLAS := atlas # Custom (MKL/ATLAS/OpenBLAS) include and lib directories. # Leave commented to accept the defaults for your choice of BLAS # (which should work)! # BLAS_INCLUDE := /path/to/your/blas # BLAS_LIB := /path/to/your/blas # Homebrew puts openblas in a directory that is not on the standard search path # BLAS_INCLUDE := $(shell brew --prefix openblas)/include # BLAS_LIB := $(shell brew --prefix openblas)/lib # This is required only if you will compile the matlab interface. # MATLAB directory should contain the mex binary in /bin. # MATLAB_DIR := /usr/local # MATLAB_DIR := /Applications/MATLAB_R2012b.app # NOTE: this is required only if you will compile the python interface. # We need to be able to find Python.h and numpy/arrayobject.h. PYTHON_INCLUDE := /usr/include/python2.7 \ /usr/lib64/python2.7/site-packages/numpy/core/include # Anaconda Python distribution is quite popular. Include path: # Verify anaconda location, sometimes it's in root. # ANACONDA_HOME := $(HOME)/anaconda # PYTHON_INCLUDE := $(ANACONDA_HOME)/include \ # $(ANACONDA_HOME)/include/python2.7 \ # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include # Uncomment to use Python 3 (default is Python 2) # PYTHON_LIBRARIES := boost_python3 python3.5m # PYTHON_INCLUDE := /usr/include/python3.5m \ # /usr/lib/python3.5/dist-packages/numpy/core/include # We need to be able to find libpythonX.X.so or .dylib. PYTHON_LIB := /usr/lib # PYTHON_LIB := $(ANACONDA_HOME)/lib # Homebrew installs numpy in a non standard path (keg only) # PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include # PYTHON_LIB += $(shell brew --prefix numpy)/lib # Uncomment to support layers written in Python (will link against Python libs) WITH_PYTHON_LAYER := 1 # Whatever else you find you need goes here. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies # INCLUDE_DIRS += $(shell brew --prefix)/include # LIBRARY_DIRS += $(shell brew --prefix)/lib # NCCL acceleration switch (uncomment to build with NCCL) # https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0) # USE_NCCL := 1 # Uncomment to use `pkg-config` to specify OpenCV library paths. # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.) # USE_PKG_CONFIG := 1 # N.B. both build and distribute dirs are cleared on `make clean` BUILD_DIR := build DISTRIBUTE_DIR := distribute # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171 # DEBUG := 1 # The ID of the GPU that 'make runtest' will use to run unit tests. TEST_GPUID := 0 # enable pretty build (comment to see full commands) Q ?= @
相應的修改做完以後,就需要重新編譯caffe了,依次執行以下三條命令,我都沒有用sudo獲取root許可權也成功了。
sudo make all
sudo make runtest
sudo make pycaffe


相關推薦

LinuxGPUCPU版本caffe切換

前些日子在HPC cluster(高效能運算機群)上安裝好了GPU版本的caffe,最近N卡驅動出了問題,導致無法使用GPU版本的caffe進行資料的訓練,我只是個普通使用者,無法去解決這個問題,所以無奈將GPU版本修改為CPU版本勉強進行一些實驗,其實主要是對Makefi

Linux如何檢視CPU型號、個數、核數、邏輯CPU數、位數、發行版本、核心資訊、記憶體、伺服器生產廠家

【原文連結】:http://blog.csdn.net/mdx20072419/article/details/7767809 http://blog.chinaunix.net/uid-22425237-id-3496577.html ---------------

Intellij idea史上最簡單的教程之Linux安裝破解Intellij idea2017

成功 zxvf java 新建 pre form 旗艦版 lan intel 一、前言 這一節我們介紹在Linux下如何安裝與破解Intellij idea2017。現在有很多公司開發環境都是Linux,所以掌握在Linux環境下使用Idea辦公也是咱們必須得掌握的技能。

Linux安裝配置Nginx

下載 訪問 準備 cep ssi config configure 你會 inpu 一、準備 Nginx版本:nginx-1.7.7.tar.gz 請自行到官網下載對應的版本。 二、步驟 ?在Linux新建一個queenLove用戶 [[email prot

linux打包壓縮

包名 大小 方便 文件 nbsp 視頻 查看 more 文本文 歸檔   文檔很多,很亂, 方便使用、查閱、閱讀 已於管理(批量刪除文件) 壓縮 a.txt /etc/passwd 文本文件壓縮後很省空間 aaa.jpeg 壓縮

linuxlastlastb命令詳解

bubuko 使用 文件的 clas ip地址 tty 遠程 默認 讀取 在linux系統中,last與lastb命令用來列出目前與過去登錄系統的用戶相關信息。指令英文原義: last, lastb - show listing of last logged in user

linux目錄文件的查找

crypt only map 是個 工作 roo splay strong 過程 參考網址:http://www.runoob.com/linux/linux-command-manual.html which命令: which命令用於查找並顯示給定命令的絕對路徑,環境

Linux查看CPU型號,內存大小,硬盤空間的命令

總結 uniq ash cpu核數 proc cores physical tro str 1.1 查看CPU個數 # cat /proc/cpuinfo | grep "physical id" | uniq | wc -l 2 **uniq命令:刪除重復行;wc &

Linux如何從普通用戶切換到root用戶

怎麽 OS 顯示 localhost 知識 term swd su - south 1.首先,我們輸入pwd命令,查看當前用戶目錄: 當前用戶是xg其中我解釋一下[xg@localhost ~]$ 這個的含義,其中xg指的是當前的用戶,localhost指的是主機名,~指

Linux查看CPU信息[/proc/cpuinfo]

超線程 inf ica cor 這也 目錄 負載 2個 內核 最近在研究linux系統負載的時候,接觸到一些關於CPU信息查看的知識,和大家分享一下。通過對/proc/cpuinfo文件中的參數的分析,也學到了不少東西。 在linux操作系統中,CPU的信息在啟動的過程中被

Linuxlscp命令

col src 註意 nbsp 技術 span 分享 應用 bubuko     Linux熟練的應用命令,才可以隨心所欲~ ls 註意:   ls -1 //每次只列出1個文件 cp 註意:   cp -u xxx xxx //註意修改時間的先

GPUCPU的區別

struct 同時 href 運行 預測 技術含量 控制 算術 truct 作者:蟲子君 鏈接:https://www.zhihu.com/question/19903344/answer/96081382 來源:知乎 著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉

Linuxjdk的安裝卸載切換

tools.jar ocs 包安裝 tin aws jsse jre rpm -e java_home 1. Linux下jdk的安裝包:   a).bin包(jdk-6u45-linux-i586-rpm.bin)   b).tar.gz包(jdk-8u144-linux

linux安裝配置Redis

修改 密碼 ted 路徑 設置密碼 fix 安裝與配置 安裝 bsp 1.安裝 (1)獲取源代碼   wget http://download.redis.io/releases/redis-4.0.8.tar.gz (2)解壓   tar xzvf redis-4.0.8

LinuxApachetomcat的整合

一.jdk安裝 1.在www.sun.com中下載linu的jdk1.6,下載到/home/lijing/下 2.在當前目錄下,輸入sh jdk-6u2-linux-i586-rpm.bin   看到 安裝程式在詢問您是否尊守許可協議頁面 ,回車,空格都可以,看完協議. &

Linux壓縮解壓

zip壓縮解壓 壓縮: zip -r dist.zip dist/* 解壓: unzip dist.zip unzip -o dist.zip // 在不提示的情況下覆蓋檔案 unzip -o -d ~/Desktop/temp // -d指定解壓目錄 tar壓縮解壓

linux查看cpu,內存,硬盤等硬件信息的方法

ast 環境變量 spc http 軟件包 sdn mem 硬件信息 ets 說明:Linux下可以在/proc/cpuinfo中看到每個cpu的詳細信息。但是對於雙核的cpu,在cpuinfo中會看到兩個cpu。常常會讓人誤以為是兩個單核的cpu。原文地址: http:/

linux升級軟體包版本等方法

       Linux環境下,要想檢視某個軟體(package)是否安裝。        rpm包方式安裝的,使用 rpm -qa | grep “軟體或者包的名字“。      

【轉】Linuxjava程序CPU佔用率高分析方法

文章轉載的地址: https://blog.linuxeye.cn/343.html   在工作當中,肯定會遇到由程式碼所導致的高CPU耗用以及記憶體溢位的情況。這種情況發生時,我們怎麼去找出原因並解決。 一般解決方法是通過top命令找出消耗資源高的執行緒id,利用strace命令檢視該執行緒

Linux備份還原MySQL資料庫

備份 [[email protected] ~]# mysqldump -u root -p mysql > ~/mysql.sql Enter password: [[email protected] ~]# ls ~/mysql.sql /root/mysq