在Ubuntu 16.04上使用Intel MKL BLAS LAPACK编译“ binica”

问题描述 投票:0回答:1

对于特定的数据分析,我使用来自ica_linux的预编译的this repository二进制文件。在该存储库的README.md中,作者指出,使用特定于体系结构的BLAS / LAPACK实现编译二进制文件时,可以大大提高速度。就我们而言,加速实际上可以节省数天的计算时间,因此我非常渴望使用适当的库来编译文件。现在,我对makefile没有太多经验,因此我对该过程有些困惑-这就是为什么我寻求您的帮助。

[我的系统是带有两个Intel Xeon E5-2650 v3 deca-core处理器和Ubuntu 16.04.6 x64的HP ProLiant d360服务器

我尝试了以下内容

克隆回购

sudo git clone https://github.com/sccn/binica
cd binica

安装英特尔MKL

我使用了this manual

sudo wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo wget https://apt.repos.intel.com/setup/intelproducts.list -O /etc/apt/sources.list.d/intelproducts.list
sudo apt update
sudo apt install intel-mkl-2020.0-088

调整Makefile.linux

这是我不太了解我必须添加哪些库的地方。我尝试了以下方法,但不确定是否是正确的方法。

PLAT = _linux

CC        = gcc
CFLAGS    = -O3 -ansi
#BLASLIB   = ./CLAPACK/lsblaspii1.2f_03.00.a
#BLASLIB   = ./CLAPACK/blas$(PLAT).a
#LAPACKLIB = ./CLAPACK/lapack$(PLAT).a
#F2CLIB    = ./CLAPACK/F2CLIBS/libF77$(PLAT).a ./CLAPACK/F2CLIBS/libI77$(PLAT).a
#LIBS      = $(LAPACKLIB) $(BLASLIB) $(F2CLIB) -lm
LIBS      = /opt/intel/mkl/lib/intel64_lin/libmkl_intel_ilp64.a
OBJS      = ica.o interfc.o r250.o randlcg.o dsum.o

ica_linux: Makefile.linux ica.h memap.h $(OBJS)
    $(CC) -o ica_linux $(OBJS) $(LIBS)

ica.o: Makefile.linux ica.h memap.h ica.c
    $(CC) -c ica.c $(CFLAGS)

interfc.o: Makefile.linux ica.h memap.h interfc.c
    $(CC) -c interfc.c $(CFLAGS)

memap.o: Makefile.linux memap.h memap.c
    $(CC) -c memap.c $(CFLAGS)

r250.o: Makefile.linux r250.h r250.c
    $(CC) -c r250.c $(CFLAGS)

randlcg.o: Makefile.linux randlcg.h randlcg.c
    $(CC) -c randlcg.c $(CFLAGS)

dsum.o: Makefile.linux dsum.c
    $(CC) -c dsum.c $(CFLAGS)

clean:
    rm -f *.o

制作文件

然后我跑了

sudo make Makefile.linux clean
sudo make Makefile.linux ica_linux

不幸的是,此错误消息失败:

```
X@Y:~/Downloads/binica$ sudo make Makefile.linux ica_linux
make: Nothing to be done for 'Makefile.linux'.
gcc -c ica.c -O3 -ansi
ica.c: In function ‘sigproc’:
ica.c:565:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘integer {aka long int}’ [-Wformat=]
   printf("number of components = %d\n",COMP_NUMBER);
          ^
ica.c:566:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘integer {aka long int}’ [-Wformat=]
   printf("number of channels = %d\n",CH_NUMBER);
          ^
ica.c: In function ‘runica’:
ica.c:904:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘integer {aka long int}’ [-Wformat=]
       printf("step %d - lrate %5f, wchange %7.6f, angledelta %4.1f deg\n",step,lrate,change,DEGCONST*angledelta);
              ^
ica.c:907:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘integer {aka long int}’ [-Wformat=]
       printf("step %d - lrate %5f, wchange %7.6f, angledelta %4.1f deg, %d subgauss\n",step,lrate,change,DEGCONST*angledelta,j);
              ^
ica.c:907:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘integer {aka long int}’ [-Wformat=]
ica.c:914:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘integer {aka long int}’ [-Wformat=]
       printf("step %d - lrate %5f, wchange %7.6f\n",step,lrate,change);
              ^
ica.c:917:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘integer {aka long int}’ [-Wformat=]
       printf("step %d - lrate %5f, wchange %7.6f, %d subgauss\n",step,lrate,change,j);
              ^
ica.c:917:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘integer {aka long int}’ [-Wformat=]
gcc -c interfc.c -O3 -ansi
interfc.c:50:17: warning: missing terminating " character
 #define HELPMSG "# ica - Perform Independent Component Analysis, standalone-version
                 ^
interfc.c:52:5: error: invalid preprocessing directive #Run
 #   Run the ICA algorithm of Bell & Sejnowski (1996) or the extended-ICA
     ^
interfc.c:53:5: error: invalid preprocessing directive #of
 #   of Lee, Girolami & Sejnowski (1998). Original Matlab code: Scott Makeig,
     ^
interfc.c:54:5: error: invalid preprocessing directive #Tony
 #   Tony Bell, et al.; C++ code: Sigurd Enghoff, CNL / Salk Institute 7/98
     ^
interfc.c:56:5: error: invalid preprocessing directive #Usage
 #   Usage:   % ica < my.sc
     ^
interfc.c:58:5: error: invalid preprocessing directive #Leading
 #   Leading # -> use default values
     ^
interfc.c:59:5: error: invalid preprocessing directive #Edit
 #   Edit a copy of this file to run an ica decomposition
     ^
interfc.c:60:5: error: invalid preprocessing directive #Contacts
 #   Contacts: {enghoff,scott,terry,tony,tewon}@salk.edu
     ^
interfc.c:62:3: error: invalid preprocessing directive #Required
 # Required variables:
   ^
interfc.c:63:5: error: unknown type name ‘DataFile’
     DataFile     berger/modeldata # Input data to decompose (floats multiplexed
     ^
interfc.c:63:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘/’ token
     DataFile     berger/modeldata # Input data to decompose (floats multiplexed
                        ^
interfc.c:63:35: error: stray ‘#’ in program
     DataFile     berger/modeldata # Input data to decompose (floats multiplexed
                                   ^
interfc.c:64:32: error: invalid preprocessing directive #by
                            #   by channel (i.e., chan1, chan2, ...))
                                ^
interfc.c:65:28: error: stray ‘#’ in program
     chans        31        # Number of data channels (= data rows)
                            ^
interfc.c:66:28: error: stray ‘#’ in program
     frames       768       # Number of data points per epoch (= data columns)
                            ^
interfc.c:67:28: error: stray ‘#’ in program
     epochs       436       # Number of epochs
                            ^
interfc.c:69:3: error: invalid preprocessing directive #FrameWindow
 # FrameWindow  20        # Number of frames per window
   ^
interfc.c:70:3: error: invalid preprocessing directive #FrameStep
 # FrameStep    4         # Number of frames to step per window
   ^
interfc.c:71:3: error: invalid preprocessing directive #EpochWindow
 # EpochWindow  100       # Number of epochs per window
   ^
interfc.c:72:3: error: invalid preprocessing directive #EpochStep
 # EpochStep    25        # Number of epochs to step per window
   ^
interfc.c:73:3: error: invalid preprocessing directive #Baseline
 # Baseline     25        # Number of data points contained in baseline
   ^
interfc.c:75:36: error: stray ‘#’ in program
     WeightsOutFile berger/data.wts # Output ICA weight matrix (floats)
                                    ^
interfc.c:76:35: error: stray ‘#’ in program
     SphereFile   berger/data.sph  # Output sphering matrix (floats)
                                   ^
interfc.c:78:3: error: invalid preprocessing directive #Processing
 # Processing options:
   ^
interfc.c:80:5: error: invalid preprocessing directive #sphering
 #   sphering     on        # Flag sphering of data (on/off)   {default: on}
     ^
interfc.c:81:5: error: invalid preprocessing directive #bias
 #   bias         on        # Perform bias adjustment (on/off) {default: on}
     ^
interfc.c:82:5: error: stray ‘\’ in program
     \exextended     1         # Perform \"extended-ICA\" using tnah() with kurtosis
     ^
interfc.c:82:31: error: stray ‘#’ in program
     \exextended     1         # Perform \"extended-ICA\" using tnah() with kurtosis
                               ^
interfc.c:82:5: error: stray ‘\’ in program
     \exextended     1         # Perform \"extended-ICA\" using tnah() with kurtosis
     ^
interfc.c:82:42: warning: missing terminating " character
     \exextended     1         # Perform \"extended-ICA\" using tnah() with kurtosis
                                          ^
interfc.c:82:5: error: missing terminating " character
     \exextended     1         # Perform \"extended-ICA\" using tnah() with kurtosis
     ^
interfc.c:83:31: error: invalid preprocessing directive #estimation
                            #  estimation every N training blocks. If N < 0,
                               ^
interfc.c:84:31: error: invalid preprocessing directive #fix
                            #  fix number of sub-Gaussian components to -N
                               ^
interfc.c:85:31: error: invalid preprocessing directive #{
                            #  {default|0: off}
                               ^
interfc.c:86:5: error: invalid preprocessing directive #pca
 #   pca          0         # Decompose a principal component subspace of
     ^
interfc.c:87:31: error: invalid preprocessing directive #the
                            #  the data. Retain this many PCs. {default|0: all}
                               ^
interfc.c:88:3: error: invalid preprocessing directive #Optional
 # Optional input variables:
   ^
interfc.c:90:4: error: invalid preprocessing directive #WeightsInFile
 #  WeightsInFile input.wts # Starting ICA weight matrix (nchans,ncomps)
    ^
interfc.c:91:31: error: invalid preprocessing directive #{
                            #  {default: identity or sphering matrix}
                               ^
interfc.c:92:28: error: stray ‘#’ in program
     lrate        2.0e-3    # Initial ICA learning rate (float << 1)
                            ^
interfc.c:93:31: error: invalid preprocessing directive #{
                            #  {default: heuristic ~5e-4}
                               ^
interfc.c:94:5: error: invalid preprocessing directive #blocksize
 #   blocksize    20        # ICA block size (integer << datalength)
     ^
interfc.c:95:31: error: invalid preprocessing directive #{
                            #  {default: heuristic fraction of log data length}
                               ^
interfc.c:96:5: error: invalid preprocessing directive #stop
 #   stop         1.0e-6    # Stop training when weight-change < this value
     ^
interfc.c:97:31: error: invalid preprocessing directive #{
                            #  {default: heuristic ~0.000001}
                               ^
interfc.c:98:28: error: stray ‘#’ in program
     maxsteps     512       # Max. number of ICA training steps {default: 128}
                            ^
interfc.c:99:5: error: invalid preprocessing directive #posact
 #   posact       on        # Make each component activation net-positive
     ^
interfc.c:100:30: error: invalid preprocessing directive #(
                            # (on/off) {default: on}
                              ^
interfc.c:101:5: error: invalid preprocessing directive #annealstep
 #   annealstep   0.98      # Annealing factor (range (0,1]) - controls
     ^
interfc.c:102:31: error: invalid preprocessing directive #the
                            #  the speed of convergence.
                               ^
interfc.c:103:5: error: invalid preprocessing directive #annealdeg
 #   annealdeg    60        # Angledelta threshold for annealing {default: 60}
     ^
interfc.c:104:5: error: invalid preprocessing directive #momentum
 #   momentum     0.0       # Momentum gain (range [0,1])      {default: 0}
     ^
interfc.c:105:5: error: invalid preprocessing directive #verbose
 #   verbose      off        # Give ascii messages (on/off) {default: on}
     ^
interfc.c:107:3: error: invalid preprocessing directive #Optional
 # Optional outputs:
   ^
interfc.c:109:4: error: invalid preprocessing directive #ActivationsFile
 #  ActivationsFile data.act # Activations of each component (ncomps,points)
    ^
interfc.c:110:4: error: invalid preprocessing directive #BiasFile
 #  BiasFile      data.bs   # Bias weights (ncomps,1)
    ^
interfc.c:111:4: error: invalid preprocessing directive #SignFile
 #  SignFile      data.sgn  # Signs designating (-1) sub- and (1) super-Gaussian
    ^
interfc.c:112:31: error: invalid preprocessing directive #components
                            #  components (ncomps,1)
                               ^
interfc.c:114:3: error: invalid preprocessing directive #This
 # This script, \"ica.sc\" is a sample ica script file. Copy and modify it as
   ^
interfc.c:114:17: warning: missing terminating " character
 # This script, \"ica.sc\" is a sample ica script file. Copy and modify it as
                 ^
interfc.c:115:3: error: invalid preprocessing directive #desired
 # desired. Note that the input data file(s) must be native floats."
   ^
interfc.c:115:67: warning: missing terminating " character
 # desired. Note that the input data file(s) must be native floats."
                                                                   ^
interfc.c: In function ‘help’:
interfc.c:170:3: error: missing terminating " character
   puts(HELPMSG);
   ^
interfc.c:170:3: error: too few arguments to function ‘puts’
interfc.c: In function ‘doit’:
interfc.c:679:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘integer {aka long int}’ [-Wformat=]
     printf("PDF will be calculated initially every %d blocks using %d data points.\n",extblocks,pdfsize);
            ^
interfc.c:679:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘integer {aka long int}’ [-Wformat=]
interfc.c:681:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘integer {aka long int}’ [-Wformat=]
     printf("PDF will not be calculated. Exactly %d sub-Gaussian components assumed.\n",nsub);
            ^
interfc.c:684:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘integer {aka long int}’ [-Wformat=]
   printf("Initial learning rate will be %g, block size %d.\n",lrate,block);
          ^
interfc.c:690:10: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘integer {aka long int}’ [-Wformat=]
   printf("Training will end when wchange < %g or after %d steps.\n",nochange,maxsteps);
          ^
interfc.c: In function ‘master’:
interfc.c:923:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    keys->token = strdup(token);
                ^
 Makefile:19: recipe for target 'interfc.o' failed
 make: *** [interfc.o] Error 1
```

任何帮助和暗示我可能在做错的事情,将不胜感激!

谢谢,亚历克斯

linux gcc makefile blas intel-mkl
1个回答
0
投票

'我不太了解我必须添加哪些库。 ”<< Alex,确实了解您需要添加的Intel MKL库的列表,请参考Intel MKL Linker Adviser以选择需要添加的库的列表。这是本文的列表:https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor

© www.soinside.com 2019 - 2024. All rights reserved.