主要是基于官网教程,在安装过程中有一些注意事项,在这里做一下说明(强烈推荐参考github给出的官方教程,非常详细,一步一步执行即可,链接https://github.com/facebookresearch/faiss/blob/master/INSTALL.md)
环境:ubunt 16.04,anaconda2(python2.7),gtx1050ti,cuda8.0 ,cudnn 6.0
首先是安装cuda8.0 和cudnn6.0,和其他所有的深度学习框架需要的一样,参考本博客其他教程
1,安装openblas
conda install openblas
2, 下载faiss,修改makefile.inc文件
- # 下载FAISS源码
- git clone https://github.com/facebookresearch/faiss.git
- # 进入FAISS源码目录
- cd faiss
- # 根据系统配置编译环境
- cp example_makefiles/makefile.inc.Linux ./makefile.inc
这里需要进到 faiss目录下的makefile.inc里手动修改,文件中默认使用的是centos,需要把centos部分注释掉,并取消ubuntu16.04的注释
这里给出 修改后的makefile.inc的文件内容:
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD+Patents license found in the
# LICENSE file in the root directory of this source tree.
# -*- makefile -*-
# tested on CentOS 7, Ubuntu 16 and Ubuntu 14, see below to adjust flags to distribution.
CC=gcc
CXX=g++
CFLAGS=-fPIC -m64 -Wall -g -O3 -mavx -msse4 -mpopcnt -fopenmp -Wno-sign-compare -fopenmp
CXXFLAGS=$(CFLAGS) -std=c++11
LDFLAGS=-g -fP

本文档基于官方教程,详细介绍了在Ubuntu 16.04上安装Faiss(包括CPU和GPU支持)的步骤,涉及Anaconda2、CUDA 8.0、CuDNN 6.0,以及OpenBLAS的安装与配置。首先安装OpenBLAS,然后下载并编译Faiss,通过测试确保安装成功,最后编译Python接口。
&spm=1001.2101.3001.5002&articleId=79528822&d=1&t=3&u=5d171e8a177a43d4bdb6a6fbe8bfad6c)
3711

被折叠的 条评论
为什么被折叠?



