mirror of https://github.com/Qiskit/qiskit.git
Simulator dependency target, fix for Power architecture (#5)
* new dependencies target (make depend) for the qasm-simulator-cpp (cherry picked from commit 3b253908a69101f14d37dac5ece4b51f0c9b80ec) * changed to executable and bug fix (cherry picked from commit ce8be89dac7fc0a40e39f0dbbf67cf32c072a4d0) * assume yes for automatic pkg install (cherry picked from commit 2cd7607db606753ae0aafa0b2fb8ffea30732dae) * -march not supported on ppc64le. Use -mcpu instead (cherry picked from commit 7cdab8ff632f2348d19b83b43781bf97f89c642b) * bugfix (cherry picked from commit 831692e34a89597e9c85706ab3e048d32e94f1f3)
This commit is contained in:
parent
ee08d1bc4d
commit
6161c8adad
4
Makefile
4
Makefile
|
@ -57,6 +57,10 @@ sim:
|
|||
make -C src/qasm-simulator-cpp/src clean
|
||||
make -C src/qasm-simulator-cpp/src
|
||||
|
||||
# Build dependencies for the simulator target
|
||||
depend:
|
||||
make -C src/qasm-simulator-cpp depend
|
||||
|
||||
coverage_erase:
|
||||
coverage erase
|
||||
|
||||
|
|
|
@ -5,5 +5,8 @@ all: sim
|
|||
sim:
|
||||
make -C src
|
||||
|
||||
depend:
|
||||
./build_dependencies.sh
|
||||
|
||||
clean:
|
||||
make -C src clean
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# build_dependencies.sh
|
||||
#
|
||||
# Dependency installer for qiskit-sdk-py/src/qasm-simulator-cpp
|
||||
# Running the script:
|
||||
# 1. Run the script directly
|
||||
# ./build_dependencies.sh
|
||||
# 2. Alternatively, build the make depend target (See the Makefile)
|
||||
# make depend
|
||||
#
|
||||
# .. note:: Tested on Ubuntu 16.04 only.
|
||||
# ------------------------------------------------------------------------------
|
||||
set -ex
|
||||
os_type=`uname -s`
|
||||
|
||||
# Check who is the current user.
|
||||
USER=$(whoami)
|
||||
|
||||
if [ ${USER} == "root" ]
|
||||
then
|
||||
SUDOCMD=""
|
||||
else
|
||||
SUDOCMD="sudo"
|
||||
fi
|
||||
|
||||
# Check the OS Type
|
||||
echo "OS is $os_type"
|
||||
|
||||
if [[ "$os_type" == "Darwin" ]]; then
|
||||
${SUDOCMD} xcode-select --install
|
||||
elif [[ "$os_type" == "Linux" ]]; then
|
||||
echo "Installing dependencies on Linux"
|
||||
linux_distro=`cat /etc/*release | grep "ID_LIKE=" | cut -c9- | tr -d '"'`
|
||||
if [[ "$linux_distro" == "debian" ]]; then
|
||||
${SUDOCMD} apt-get update
|
||||
${SUDOCMD} apt-get -y install build-essential libblas-dev liblapack-dev
|
||||
elif [[ "$linux_distro" == "fedora" ]]; then
|
||||
${SUDOCMD} yum update
|
||||
${SUDOCMD} yum -y install devtoolset-6 blas blas-devel lapack lapack-devel
|
||||
${SUDOCMD} scl enable devtoolset-6 bash
|
||||
else
|
||||
echo "Unsupported linux distro: $linux_distro"
|
||||
fi
|
||||
fi
|
|
@ -6,13 +6,18 @@ OUTPUT_DIR = ../../../out/src/qasm-simulator-cpp
|
|||
CC = g++
|
||||
|
||||
# Use Homebrew GNU g++ for enabling OpenMP on macOS
|
||||
|
||||
OS:=$(shell uname)
|
||||
GCC7:=$(shell g++-7 --version | grep ^'command not found')
|
||||
ifeq ($(OS)$(GCC7),Darwin)
|
||||
CC = g++-7
|
||||
endif
|
||||
|
||||
# -march not supported on ppc64le (Power). Use -mcpu instead
|
||||
ARCH:=$(shell uname -m)
|
||||
ifeq ($(ARCH),ppc64le)
|
||||
OPT = -O3 -mcpu=native -ffast-math
|
||||
endif
|
||||
|
||||
# Check if compiler is Apple LLVM and doesn't support OpenMP
|
||||
APPLELLVM = $(shell ${CC} --version | grep ^Apple)
|
||||
ifeq ($(APPLELLVM),)
|
||||
|
@ -50,6 +55,9 @@ sim: main.o
|
|||
sim_debug: main.o
|
||||
$(CC) -g $(CPPFLAGS) $(DEFINES) -o ${OUTPUT_DIR}/qasm_simulator_cpp_debug ${OUTPUT_DIR}/main.o $(LIBS)
|
||||
|
||||
depend:
|
||||
../build_dependencies.sh
|
||||
|
||||
clean:
|
||||
rm -rf ${OUTPUT_DIR}
|
||||
|
||||
|
|
Loading…
Reference in New Issue