odelaneau / shapeit4

Segmented HAPlotype Estimation and Imputation Tool
MIT License
90 stars 18 forks source link

Illegal instruction (core dumped) #73

Open Grelot opened 2 years ago

Grelot commented 2 years ago

Hi everyone,

Tried to install SHAPEIT 4.2.2 inside container with singularity :

Bootstrap: docker
From: ubuntu

%labels
    AUTHOR Daphne VERDELET
    AUTHOR Pierre-Edouard GUERIN
    BASE_IMG Ubuntu
    PROG SHAPEIT
    PROG_VER 4.2.2

%help
>>> SHAPEIT 4.2.2 / Ubuntu latest <<<
Installed scripts :
    shapeit4

%post

    TZ="Europe/Paris"
    ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo $TZ > /etc/timezone

    apt update
    apt upgrade -y
    apt install -y dialog locales
    rm -rf /var/lib/apt/lists/*
    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
    export LANG="en_US.utf8"

    apt update
    apt install -y g++ make gcc zlib1g-dev libbz2-dev liblzma-dev wget bzip2 libboost-all-dev  libboost-iostreams-dev libboost-program-options-dev libboost-dev git 
    apt install -y libcurl3-dev libssl-dev libc6-dev  libmkl-avx2 libpthread-stubs0-dev 

    wget https://github.com/odelaneau/shapeit4/archive/refs/tags/v4.2.2.tar.gz
    tar xvfz v4.2.2.tar.gz
    cd shapeit4-4.2.2
    cd tools
    wget https://github.com/samtools/htslib/releases/download/1.11/htslib-1.11.tar.bz2
    bunzip2 htslib-1.11.tar.bz2
    tar -xvf htslib-1.11.tar
    cd htslib-1.11
    ./configure
    make
    cd ../..
    sed -i '5s/.*/HTSLIB_INC=\/shapeit4-4.2.2\/tools\/htslib-1.11/' makefile
    sed -i '6s/.*/HTSLIB_LIB=\/shapeit4-4.2.2\/tools\/htslib-1.11\/libhts.a/' makefile
    ls /usr/lib/x86_64-linux-gnu/libboost_iostreams.a
    make
    cp /shapeit4-4.2.2/bin/shapeit4.2 /usr/local/bin

The build works but when I run the command:

singularity exec shapeit/4.2.2/shapeit.sif shapeit4.2 --input shapeit4-4.2.2/test/unphased.vcf.gz --map shapeit4-4.2.2/test/chr20.b37.gmap.gz --region 20 --output phased.vcf.gz

or simply

singularity exec shapeit/4.2.2/shapeit.sif shapeit4.2 --help

It returns:

Illegal instruction (core dumped)

Any idea why I get this output ? I followed instructions at https://odelaneau.github.io/shapeit4/#installation

pettyalex commented 2 years ago

@Grelot What hardware or virtualization was this running on? It looks like this may have been running on a CPU without AVX2 support? Most recent Intel server CPUs and higher-end desktop / laptop CPUs have AVX2 support, but older or less expensive ones do not.

Grelot commented 2 years ago

We can use 2 kind of processors:

grep -o 'avx[^ ]*' /proc/cpuinfo

AVX on our main cluster

pettyalex commented 2 years ago

We can use 2 kind of processors:

  • Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
  • Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
grep -o 'avx[^ ]*' /proc/cpuinfo

AVX on our main cluster

The E5-2690 does not have AVX2, and shapeit4 requires AVX2 to run quickly. AVX2 first appeared on the Xeon E5 v3 line.

You should be able to re-build shapeit4 without the -mavx2 -mfma compiler flags, as documented here: https://github.com/odelaneau/shapeit4/blob/master/makefile#L30

It'll be very slow, though.