Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch the default to enable mlir. #2366

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# SOURCE_DIR <DIR>: the directory that SOURCE_LOCATION is relative to (if not the default)
# LAUNCH_COMMAND <COMMAND>: the command to launch the test (e.g., mpirun)
function(add_nvqpp_test TEST_NAME SOURCE_LOCATION)
cmake_parse_arguments(PARSED_ARGS "" "TARGET;LABELS;SOURCE_DIR;LAUNCH_COMMAND;APPLICATION_ARGS;TARGET_OPTION" "" ${ARGN})
set(NVQPP_COMPILE_ARGS "")
cmake_parse_arguments(PARSED_ARGS "" "TARGET;LABELS;SOURCE_DIR;LAUNCH_COMMAND;APPLICATION_ARGS;TARGET_OPTION" "" ${ARGN})
set(NVQPP_COMPILE_ARGS "--library-mode ")
if(PARSED_ARGS_TARGET)
set(NVQPP_COMPILE_ARGS "${NVQPP_COMPILE_ARGS} --target ${PARSED_ARGS_TARGET}")
if (PARSED_ARGS_TARGET_OPTION)
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/applications/cpp/grover.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Compile and run with:
// ```
// nvq++ grover.cpp -o grover.x && ./grover.x
// nvq++ --library-mode grover.cpp -o grover.x && ./grover.x
// ```

#include <cmath>
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx/targets/cpp/photonics.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Compile and run with:
// ```
// nvq++ --target orca-photonics photonics.cpp
// nvq++ --library-mode --target orca-photonics photonics.cpp
// ./a.out
// ```

Expand All @@ -24,4 +24,4 @@ int main() {

auto state = cudaq::get_state(photonicsKernel{});
state.dump();
}
}
8 changes: 6 additions & 2 deletions scripts/validate_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ do
if [ -n "$intended_target" ]; then
echo "Intended for execution on $intended_target backend."
fi
use_library_mode=`sed -e '/^$/,$d' $ex | grep -oP '^//\s*nvq++.+-library-mode'`
if [ -n "$use_library_mode" ]; then
nvqpp_extra_options="--library-mode"
fi

for t in $requested_backends
do
Expand Down Expand Up @@ -214,7 +218,7 @@ do
for (( i=0; i<${arraylength}; i++ ));
do
echo " Testing nvidia target option: ${optionArray[$i]}"
nvq++ $ex $target_flag --target-option "${optionArray[$i]}"
nvq++ $nvqpp_extra_options $ex $target_flag --target-option "${optionArray[$i]}"
if [ ! $? -eq 0 ]; then
let "failed+=1"
echo " :x: Compilation failed for $filename." >> "${tmpFile}_$(echo $t | tr - _)"
Expand All @@ -235,7 +239,7 @@ do
rm a.out /tmp/cudaq_validation.out &> /dev/null
done
else
nvq++ $ex $target_flag
nvq++ $nvqpp_extra_options $ex $target_flag
if [ ! $? -eq 0 ]; then
let "failed+=1"
echo ":x: Compilation failed for $filename." >> "${tmpFile}_$(echo $t | tr - _)"
Expand Down
2 changes: 1 addition & 1 deletion targettests/Remote-Sim/compile_errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// REQUIRES: remote-sim
// clang-format off
// RUN: nvq++ %cpp_std --target remote-mqpu %s 2>&1 | FileCheck %s
// RUN: nvq++ --library-mode %cpp_std --target remote-mqpu %s 2>&1 | FileCheck %s
// clang-format on

#include <cudaq.h>
Expand Down
2 changes: 1 addition & 1 deletion targettests/Remote-Sim/nested_vectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// REQUIRES: remote-sim
// clang-format off
// RUN: nvq++ %cpp_std --target remote-mqpu %s -o %t && %t
// RUN: nvq++ --library-mode %cpp_std --target remote-mqpu %s -o %t && %t
// clang-format on

#include "remote_test_assert.h"
Expand Down
2 changes: 1 addition & 1 deletion targettests/Remote-Sim/unsupport_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// REQUIRES: remote-sim

// clang-format off
// RUN: nvq++ %cpp_std --target remote-mqpu %s 2>&1 | FileCheck %s
// RUN: nvq++ --library-mode %cpp_std --target remote-mqpu %s |& FileCheck %s
// clang-format on

#include <cudaq.h>
Expand Down
2 changes: 1 addition & 1 deletion targettests/execution/state_preparation_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
******************************************************************************/

// Simulators
// RUN: nvq++ %cpp_std --enable-mlir %s -o %t && %t | FileCheck %s
// RUN: nvq++ %cpp_std %s -o %t && %t | FileCheck %s

// Quantum emulators
// RUN: nvq++ %cpp_std -target quantinuum -emulate %s -o %t && \
Expand Down
5 changes: 4 additions & 1 deletion tools/nvqpp/nvq++.in
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ fi
# We default to LIBRARY_MODE, physical
# Quantum Targets can override this to turn on
# our MLIR compilation workflow.
LIBRARY_MODE=true
LIBRARY_MODE=false

CXX=${LLVMBIN}clang++${llvm_suffix}
TARGET_ARGS=()
Expand Down Expand Up @@ -506,6 +506,9 @@ while [ $# -ne 0 ]; do
--enable-mlir)
LIBRARY_MODE=false
;;
--library-mode)
LIBRARY_MODE=true
;;
--clang-verbose | -clang-verbose)
CLANG_VERBOSE="-v"
;;
Expand Down
Loading