在非root用户的目录下安装了Intel mkl的库,也安装了mpich/openmpi 但是编译程序时都出现fatal error: mpi.h: No such file or directory // fatal error: mkl.h: No such file or directory错误
运行指令:mpicc -o cannon cannon.c
1>更改程序中的#include "mpi.h" 为 include <mpi.h> 未解决
运行 mpicc -o cannon cannon.c -I/home/wangruting/software2/mpich-3.3.2/include -L/home/wangruting/software2/mpich-3.3.2/lib
解决了fatal error
运行 mpirun -np 4 ./cannon
2>添加环境变量到~/.bashrc文件中
export PATH=$PATH:/home/wangruting/intel/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_LIB:/home/wangruting/intel/lib/intel64:/home/wangruting/intel/mkl/lib/intel64
编译时加 -I/home/wangruting/intel/mkl/include 表示优先在此路径寻找头文件
加-L/home/wangruting/intel/mkl/lib/intel64 -L/home/wangruting/intel/lib/intel64 表示优先在此路径寻找库文件
运行命令: gcc example.c -o example -I/home/wangruting/intel/mkl/inculde -L/home/wangruting/intel/mkl/lib/intel64 -lm -dl -lpthread -liomp5 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core(未解决)