Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/ci-codecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-10.15'
imageName: 'macOS-latest'
#windows: # No sanitizers supported on Win at the moment.
# imageName: 'windows-latest'
pool:
Expand Down
2 changes: 1 addition & 1 deletion build/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-10.15'
imageName: 'macOS-latest'
windows:
imageName: 'windows-latest'
pool:
Expand Down
2 changes: 1 addition & 1 deletion build/steps-codecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ steps:

# QIR Runtime:
- pwsh: src/Qir/Runtime/prerequisites.ps1
displayName: "Install QIR Runtime Prerequisistes"
displayName: "Install QIR Runtime Prerequisites"
workingDirectory: $(System.DefaultWorkingDirectory)

- pwsh: src/Qir/Runtime/build-qir-runtime.ps1
Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Common/cmake/unit_test_include.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ macro(add_unit_test target)
if(DEFINED ENV{NATIVE_SIMULATOR})
set(TEST_DEPS1 $ENV{NATIVE_SIMULATOR})
else()
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../../Simulation/native/build/$ENV{BUILD_CONFIGURATION}")
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../../Simulation/native/build/drop")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kuzminrobin Why did this path change? Seems like the CI should have had issues before or after.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the native simulator was built with MSVC (on Win), the compiler was putting the binary to
Simulation/native/build/Release (whereas the GCC on other platforms was putting the binary to
Simulation/native/build). Then the scripts were copying the binary to
Simulation/native/build/drop (on all platforms), but the dependency in the tests was different for win and other platforms.
After the native simulator has been migrated to Clang, on all the platforms the binary started being put
Simulation/native/build and copied to
Simulation/native/build/drop. This change has unified the dependency.

endif()

set(TEST_DEPS2 "${CMAKE_BINARY_DIR}/bin")
Expand Down
12 changes: 6 additions & 6 deletions src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace Quantum
{
if (this->simulatorId != NULL_SIMULATORID)
{
typedef unsigned (*TDestroy)(unsigned);
typedef void (*TDestroy)(unsigned);
static TDestroy destroySimulatorInstance =
reinterpret_cast<TDestroy>(LoadProc(this->handle, "destroy"));
assert(destroySimulatorInstance);
Expand All @@ -226,7 +226,7 @@ namespace Quantum
// Deprecated, use `DumpMachine()` and `DumpRegister()` instead.
void GetState(TGetStateCallback callback) override
{
typedef bool (*TDump)(unsigned, TGetStateCallback);
typedef void (*TDump)(unsigned, TGetStateCallback);
static TDump dump = reinterpret_cast<TDump>(this->GetProc("Dump"));
dump(this->simulatorId, callback);
}
Expand Down Expand Up @@ -462,7 +462,7 @@ namespace Quantum

void R(PauliId axis, QubitIdType target, double theta) override
{
typedef unsigned (*TR)(unsigned, unsigned, double, unsigned);
typedef void (*TR)(unsigned, unsigned, double, unsigned);
static TR r = reinterpret_cast<TR>(this->GetProc("R"));

r(this->simulatorId, GetBasis(axis), theta, GetQubitId(target));
Expand All @@ -472,7 +472,7 @@ namespace Quantum
void ControlledR(long numControls, QubitIdType controls[], PauliId axis, QubitIdType target,
double theta) override
{
typedef unsigned (*TMCR)(unsigned, unsigned, double, unsigned, unsigned*, unsigned);
typedef void (*TMCR)(unsigned, unsigned, double, unsigned, unsigned*, unsigned);
static TMCR cr = reinterpret_cast<TMCR>(this->GetProc("MCR"));

std::vector<unsigned> ids = GetQubitIds(numControls, controls);
Expand All @@ -483,7 +483,7 @@ namespace Quantum

void Exp(long numTargets, PauliId paulis[], QubitIdType targets[], double theta) override
{
typedef unsigned (*TExp)(unsigned, unsigned, unsigned*, double, unsigned*);
typedef void (*TExp)(unsigned, unsigned, unsigned*, double, unsigned*);
static TExp exp = reinterpret_cast<TExp>(this->GetProc("Exp"));
std::vector<unsigned> ids = GetQubitIds(numTargets, targets);
std::vector<unsigned> convertedBases = GetBases(numTargets, paulis);
Expand All @@ -494,7 +494,7 @@ namespace Quantum
void ControlledExp(long numControls, QubitIdType controls[], long numTargets, PauliId paulis[],
QubitIdType targets[], double theta) override
{
typedef unsigned (*TMCExp)(unsigned, unsigned, unsigned*, double, unsigned, unsigned*, unsigned*);
typedef void (*TMCExp)(unsigned, unsigned, unsigned*, double, unsigned, unsigned*, unsigned*);
static TMCExp cexp = reinterpret_cast<TMCExp>(this->GetProc("MCExp"));
std::vector<unsigned> idsTargets = GetQubitIds(numTargets, targets);
std::vector<unsigned> idsControls = GetQubitIds(numControls, controls);
Expand Down
4 changes: 3 additions & 1 deletion src/Qir/Runtime/public/QubitManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ namespace Quantum
// No complex scenarios for now. Don't need to support copying/moving.
CQubitManager(const CQubitManager&) = delete;
CQubitManager& operator=(const CQubitManager&) = delete;
virtual ~CQubitManager();
~CQubitManager(); // If this dtor is made _virtual_ then the QIR RT tests crash (at least in Debug config)
// if the native simulator is compiled with Clang (as opposed to GCC). Nothing wrong found in
// the code, probably is the compiler bug.

// Restricted reuse area control
void StartRestrictedReuseArea();
Expand Down
4 changes: 3 additions & 1 deletion src/Qir/Runtime/test-qir-runtime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

. (Join-Path $PSScriptRoot .. qir-utils.ps1)

# TODO: `ASAN_OPTIONS=check_initialization_order=1` (https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking).
# TODO: macOS: `ASAN_OPTIONS=detect_leaks=1` (https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection).
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:" `
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true:" `
+ "detect_invalid_pointer_pairs=2"

if (-not (Test-CTest (Join-Path $PSScriptRoot bin $Env:BUILD_CONFIGURATION unittests) "QIR Runtime")) {
throw "At least one project failed testing. Check the logs."
Expand Down
2 changes: 1 addition & 1 deletion src/Qir/Samples/StandaloneInputReference/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ add_test(
if(DEFINED ENV{NATIVE_SIMULATOR})
set(TEST_DEPS1 $ENV{NATIVE_SIMULATOR})
else()
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../../Simulation/native/build/$ENV{BUILD_CONFIGURATION}")
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../../Simulation/native/build/drop")
endif()

set(TEST_DEPS2 "${PROJECT_SOURCE_DIR}/../Runtime/bin/$ENV{BUILD_CONFIGURATION}/bin")
Expand Down
4 changes: 3 additions & 1 deletion src/Qir/Samples/test-qir-samples.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

. (Join-Path $PSScriptRoot .. qir-utils.ps1)

# TODO: `ASAN_OPTIONS=check_initialization_order=1` (https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking).
# TODO: macOS: `ASAN_OPTIONS=detect_leaks=1` (https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection).
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:" `
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true:" `
+ "detect_invalid_pointer_pairs=2"

if (-not (Test-CTest (Join-Path $PSScriptRoot bin $Env:BUILD_CONFIGURATION StandaloneInputReference) "QIR Samples (StandaloneInputReference)")) {
throw "At least one project failed testing. Check the logs."
Expand Down
12 changes: 4 additions & 8 deletions src/Qir/Tests/test-qir-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ if ($Env:BUILD_CONFIGURATION -eq "Debug")
if (-not ($IsWindows))
{
$env:LSAN_OPTIONS += "suppressions=../../../../LSan.ignore" # https://clang.llvm.org/docs/AddressSanitizer.html#suppressing-memory-leaks
if (-not ($IsMacOS))
{
$env:ASAN_OPTIONS += "check_initialization_order=1" # https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking
}
#else # AddressSanitizer: detect_leaks is not supported on this platform. Re-enable this once supported.
#{
# $env:ASAN_OPTIONS += "detect_leaks=1" # https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection
#}
# TODO: macOS: `ASAN_OPTIONS=detect_leaks=1` (https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection).
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:" `
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true"
# + ":detect_invalid_pointer_pairs=2" TODO(rokuzmin, #883): ==8218==ERROR: AddressSanitizer: invalid-pointer-pair: 0x602000000af4 0x602000000af0
}
}

Expand Down
11 changes: 0 additions & 11 deletions src/Simulation/Native/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,3 @@ foo*
CMakeFiles/
CMakeCache.txt
*.so

# Ignore build artifacts...
win10
# ...except for vcomp140, which isn't actually a build
# artifact, but provides the Visual C/C++ OpenMP runtime
# needed by the full-state simulator.
#
# Making sure that this file is in the repo will make
# sure it ends up in our final NuGet packages, as needed
# for the full-state simulator to work correctly.
!win10/vcomp140.dll
77 changes: 63 additions & 14 deletions src/Simulation/Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,75 @@ option(USE_SINGLE_PRECISION "Use single-precision floating point operations" OFF
option(HAVE_INTRINSICS "Have AVX intrinsics" OFF)
option(USE_GATE_FUSION "Use gate fusion" ON)

# windows specific flags
if (MSVC)
# always create debug info
add_definitions("/Zi")
add_definitions("/Z7")

# build with no VC runtime depedencies:
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT /Qspectre /guard:cf /Zi /Z7")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /Qspectre /guard:cf")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
else (MSVC)
set(CMAKE_CXX_FLAGS "-static-libgcc")
endif (MSVC)

# Always use Spectre mitigations where available
if (WIN32)
# Enforce use of static runtime (avoids target machine needing msvcrt installed).
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

# Locate the vswhere application, which will provide paths to any installed Visual Studio instances.
# By invoking it with "-find **/lib/spectre/x64" we will find any Spectre mitigated libaries that
# have been installed.
find_program(_vswhere_tool
NAMES vswhere
PATHS "$ENV{ProgramFiles\(x86\)}/Microsoft Visual Studio/Installer")
if (NOT ${vswhere})
message(FATAL_ERROR "Could not locate vswhere.exe - unable to source vc redistributable")
endif()
execute_process(
COMMAND "${_vswhere_tool}" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find **/14.29.*/**/lib/spectre/x64 -sort
OUTPUT_VARIABLE _vs_install_loc_out
RESULT_VARIABLE _vs_where_exitcode
OUTPUT_STRIP_TRAILING_WHITESPACE)
file(TO_CMAKE_PATH "${_vs_install_loc_out}" SPECTRE_LIB_PATH_OUT)
string(REGEX REPLACE "[\r\n]+" ";" SPECTRE_LIB_PATH ${SPECTRE_LIB_PATH_OUT})
message(INFO "*** install loc: ${SPECTRE_LIB_PATH}")

# Locate the spectre mitigated runtime libraries and fail if they can't be found. Targets in this
# cmake project can use the variables to explicitly link these libraries rather than using the
# non-mitigated libraries that are found by default.
find_library(LIBCMT_SPECTRE_REL libcmt PATHS ${SPECTRE_LIB_PATH} REQUIRED)
find_library(LIBCMT_SPECTRE_DEB libcmtd PATHS ${SPECTRE_LIB_PATH} REQUIRED)
set(LIBCMT_SPECTRE debug ${LIBCMT_SPECTRE_DEB} optimized ${LIBCMT_SPECTRE_REL})
message(INFO "*** using spectre lib: ${LIBCMT_SPECTRE}")
find_library(LIBCPMT_SPECTRE_REL libcpmt PATHS ${SPECTRE_LIB_PATH} REQUIRED)
find_library(LIBCPMT_SPECTRE_DEB libcpmtd PATHS ${SPECTRE_LIB_PATH} REQUIRED)
set(LIBCPMT_SPECTRE debug ${LIBCPMT_SPECTRE_DEB} optimized ${LIBCPMT_SPECTRE_REL})
message(INFO "*** using spectre lib: ${LIBCPMT_SPECTRE}")
find_library(LIBVCRUNTIME_SPECTRE_REL libvcruntime PATHS ${SPECTRE_LIB_PATH} REQUIRED)
find_library(LIBVCRUNTIME_SPECTRE_DEB libvcruntimed PATHS ${SPECTRE_LIB_PATH} REQUIRED)
set(LIBVCRUNTIME_SPECTRE debug ${LIBVCRUNTIME_SPECTRE_DEB} optimized ${LIBVCRUNTIME_SPECTRE_REL})
message(INFO "*** using spectre lib: ${LIBVCRUNTIME_SPECTRE}")
set(SPECTRE_LIBS
${LIBCMT_SPECTRE}
${LIBCPMT_SPECTRE}
${LIBVCRUNTIME_SPECTRE})

add_link_options("LINKER:/guard:cf")
endif()

if (NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mspeculative-load-hardening -mretpoline")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mspeculative-load-hardening -mretpoline")
endif()

include_directories(${PROJECT_BINARY_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src)

# OpenMP
if(ENABLE_OPENMP)

if (APPLE)
set(OPENMP_PATH "/usr/local/opt/libomp")
set(OPENMP_COMPILER_FLAGS "-Xpreprocessor -fopenmp -I${OPENMP_PATH}/include -lomp -L${OPENMP_PATH}/lib")
set(OPENMP_LIB_NAME "omp")

set(OpenMP_CXX_FLAGS "${OPENMP_COMPILER_FLAGS}")
set(OpenMP_C_FLAGS "${OPENMP_COMPILER_FLAGS}")
set(OpenMP_CXX_LIB_NAMES "${OPENMP_LIB_NAME}")
set(OpenMP_C_LIB_NAMES "${OPENMP_LIB_NAME}")
set(OpenMP_omp_LIBRARY "${OPENMP_PATH}/lib/libomp.dylib")
endif()

find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
Expand Down
53 changes: 45 additions & 8 deletions src/Simulation/Native/build-native-simulator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,62 @@ if (-not (Test-Path $nativeBuild)) {
}
Push-Location $nativeBuild

# Search for "sanitize" in
# https://clang.llvm.org/docs/ClangCommandLineReference.html
# https://man7.org/linux/man-pages/man1/gcc.1.html
$SANITIZE_FLAGS=`
"-fsanitize=undefined " `
+ "-fsanitize=shift -fsanitize=shift-base " `
+ "-fsanitize=integer-divide-by-zero -fsanitize=float-divide-by-zero " `
+ "-fsanitize=unreachable " `
+ "-fsanitize=vla-bound -fsanitize=null -fsanitize=return " `
+ "-fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=alignment -fsanitize=object-size " `
+ "-fsanitize=float-cast-overflow -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool -fsanitize=enum " `
+ "-fsanitize=vptr -fsanitize=pointer-overflow -fsanitize=builtin " `
+ "-fsanitize=implicit-conversion -fsanitize=local-bounds -fsanitize=nullability " `
`
+ "-fsanitize=address " `
+ "-fsanitize=pointer-compare -fsanitize=pointer-subtract " `
+ "-fsanitize-address-use-after-scope " `
+ "-fno-omit-frame-pointer -fno-optimize-sibling-calls"

#+ "-fsanitize=unsigned-integer-overflow " # TODO(rokuzmin, #884): Disable this option for _specific_ lines
# of code, but not for the whole binary.

# There should be no space after -D CMAKE_BUILD_TYPE= but if we provide the environment variable inline, without
# the space it doesn't seem to get substituted... With invalid -D CMAKE_BUILD_TYPE argument cmake silently produces
# a DEBUG build.
if (($IsWindows) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Win"))))
{
Write-Host "On Windows build native simulator using the default C/C++ compiler (should be MSVC)"
cmake -D BUILD_SHARED_LIBS:BOOL="1" -D CMAKE_BUILD_TYPE="$Env:BUILD_CONFIGURATION" ..
$CMAKE_C_COMPILER = "-DCMAKE_C_COMPILER=clang.exe"
$CMAKE_CXX_COMPILER = "-DCMAKE_CXX_COMPILER=clang++.exe"

if ((!(Get-Command clang -ErrorAction SilentlyContinue) -and (choco find --idonly -l llvm) -contains "llvm") -or `
(Test-Path Env:/AGENT_OS)) {
# LLVM was installed by Chocolatey, so add the install location to the path.
$env:PATH = "$($env:SystemDrive)\Program Files\LLVM\bin;$env:Path"
}

cmake -G Ninja -D BUILD_SHARED_LIBS:BOOL="1" $CMAKE_C_COMPILER $CMAKE_CXX_COMPILER `
-D CMAKE_BUILD_TYPE="$Env:BUILD_CONFIGURATION" ..
# Without `-G Ninja` we fail to switch from MSVC to Clang.
# Sanitizers are not supported on Windows at the moment. Check again after migrating from Clang-11.
}
elseif (($IsLinux) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Lin"))))
{
Write-Host "On Linux build native simulator using gcc (needed for OpenMP)"
cmake -D BUILD_SHARED_LIBS:BOOL="1" -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ -D CMAKE_BUILD_TYPE="$Env:BUILD_CONFIGURATION" ..
cmake -D BUILD_SHARED_LIBS:BOOL="1" -D CMAKE_C_COMPILER=clang-11 -D CMAKE_CXX_COMPILER=clang++-11 `
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like sanitizer flags are being added even for release builds, which we don't want. The sanitizers should only be enabled for debug builds or only in the sanitizer pipeline, we don't want to ship binaries on linux and mac that have sanitizers enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly, The sanitizer flags are only added for DEBUG, see below:
CMAKE_C_FLAGS_DEBUG="$SANITIZE_FLAGS"
CMAKE_CXX_FLAGS_DEBUG="$SANITIZE_FLAGS"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I misread, you are correct!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please uncheck the "Change requested" flag?

-D CMAKE_C_FLAGS_DEBUG="$SANITIZE_FLAGS" `
-D CMAKE_CXX_FLAGS_DEBUG="$SANITIZE_FLAGS" `
-D CMAKE_BUILD_TYPE="$Env:BUILD_CONFIGURATION" ..
}
elseif (($IsMacOS) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Darwin"))))
{
Write-Host "On MacOS build native simulator using gcc (needed for OpenMP)"
# `gcc`on Darwin seems to be a shim that redirects to AppleClang, to get real gcc, must point to the specific
# version of gcc we've installed.
cmake -D BUILD_SHARED_LIBS:BOOL="1" -D CMAKE_C_COMPILER=gcc-7 -D CMAKE_CXX_COMPILER=g++-7 -D CMAKE_BUILD_TYPE="$Env:BUILD_CONFIGURATION" ..
Write-Host "On MacOS build using the default C/C++ compiler (should be AppleClang)"

cmake -D BUILD_SHARED_LIBS:BOOL="1" `
-D CMAKE_C_FLAGS_DEBUG="$SANITIZE_FLAGS" `
-D CMAKE_CXX_FLAGS_DEBUG="$SANITIZE_FLAGS" `
-D CMAKE_BUILD_TYPE="$Env:BUILD_CONFIGURATION" ..
}
else {
cmake -D BUILD_SHARED_LIBS:BOOL="1" -D CMAKE_BUILD_TYPE="$Env:BUILD_CONFIGURATION" ..
Expand Down
Binary file added src/Simulation/Native/linux/libomp.so.5
Binary file not shown.
Binary file added src/Simulation/Native/osx/libomp.dylib
Binary file not shown.
32 changes: 23 additions & 9 deletions src/Simulation/Native/prerequisites.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@
# Licensed under the MIT License.

if (($IsMacOS) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Darwin")))) {
# building with gcc-9 succeeds but some of the unit tests fail
Write-Host "Install gcc-7 as pre-req for building native simulator on MacOS"
# temporary workaround for Bintray sunset
# remove this after Homebrew is updated to 3.1.1 on MacOS image, see:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md
brew update
brew install gcc@7
} else {
Write-Host "No pre-reqs for building native simulator on platforms other than MacOS"
brew install libomp
} elseif (($IsWindows) -or ((Test-Path Env:/AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Win")))) {
if (!(Get-Command clang -ErrorAction SilentlyContinue) -or `
(Test-Path Env:/AGENT_OS)) {
choco install llvm --version=11.1.0 --allow-downgrade
Write-Host "##vso[task.setvariable variable=PATH;]$($env:SystemDrive)\Program Files\LLVM\bin;$Env:PATH"
}
if (!(Get-Command ninja -ErrorAction SilentlyContinue)) {
choco install ninja
}
if (!(Get-Command cmake -ErrorAction SilentlyContinue)) {
choco install cmake
}
refreshenv
}
else {
if (Get-Command sudo -ErrorAction SilentlyContinue) {
sudo apt update
sudo apt-get install -y clang-11
} else {
apt update
apt-get install -y clang-11
}
}


Expand Down
Loading