Skip to content
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 .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ jobs:
if [ "$RUNNER_OS" == "Windows" ]; then
venv/Scripts/activate
else
. venv/bin/activate
source venv/bin/activate
fi
pip install .
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ cmake_install.cmake
CMakeCache.txt
CMakeFiles/
pystaq.egg-info/
/uv.lock
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Pre-release

- Updated third party library [fmt](https://github.com/fmtlib/fmt) to version
11.1.2
- Fixed MSVC compiling issues on Windows

# Version 3.5 - 8 March 2024

- Replaced ["CHANGES"] by ["CHANGES.md"],
Expand Down
28 changes: 20 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,30 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
You may need to remove CMakeCache.txt.")
endif()

# Force clang to use libc++
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options("-stdlib=libc++")
endif()
# # Force Clang to use libc++
# if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
# add_compile_options("-stdlib=libc++")
# endif()

# Windows issues with Microsoft Visual Studio
if(MSVC)
add_definitions(-DNOMINMAX)
# MSVC lack of pthread.h
include_directories(SYSTEM libs/third_party/pthreadwin32)
add_compile_options(-bigobj)
add_compile_options(/bigobj)
add_compile_options(/utf-8)
if(MSVC_VERSION GREATER_EQUAL 1914)
add_compile_options("/Zc:__cplusplus")
endif()
endif()

# GNU MP warnings for literal operators with whitespace, e.g.
# auto operator "" _x (unsigned long long); // deprecated
# auto operator ""_x (unsigned long long); // correct
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options(-Wno-deprecated-literal-operator)
endif()

# MinGW or Cygwin have issues with object files that are too large
if(MINGW OR CYGWIN)
add_compile_options("-Wa,-mbig-obj")
Expand Down Expand Up @@ -100,7 +110,7 @@ add_subdirectory(src/tools)
# Unit testing
add_subdirectory(${CMAKE_SOURCE_DIR}/unit_tests/ EXCLUDE_FROM_ALL SYSTEM)

# Enable all warnings for GNU gcc and Clang/AppleClang
# Enable all warnings for GCC and Clang/AppleClang
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID}
STREQUAL "GNU")
add_compile_options("-pedantic" "-Wall" "-Wextra" "-Weffc++")
Expand Down Expand Up @@ -139,8 +149,10 @@ endif()

# Uninstall
# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
# UNIX/Linux: sudo cmake --build build --target uninstall Windows: cmake
# --build build --target uninstall
#
# UNIX/Linux: sudo cmake --build build --target uninstall
#
# Windows: cmake --build build --target uninstall
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/staq_uninstall.cmake.in"
Expand Down
131 changes: 131 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ platform-independent, supporting

- [CMake](https://cmake.org/)
- pp+17 compliant compiler, e.g.,
[gcc](https://gcc.gnu.org/),
[clang](https://clang.llvm.org),
[GCC](https://gcc.gnu.org/),
[Clang](https://clang.llvm.org),
[MSVC](https://visualstudio.microsoft.com/vs/)

- Optional, [GNU MP](https://gmplib.org/) library for building the grid synth
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 - 2024 softwareQ Inc. All rights reserved.
Copyright (c) 2019 - 2025 softwareQ Inc. All rights reserved.

MIT License

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ languages and libraries to closely follow the OpenQASM 2.0 source.
Check out the [Wiki](https://github.com/softwareQinc/staq/wiki) for more
information about the library and included tools.

Copyright (c) 2019 - 2024 softwareQ Inc. All rights reserved.
Copyright (c) 2019 - 2025 softwareQ Inc. All rights reserved.

---

Expand Down
32 changes: 18 additions & 14 deletions cmake/FindGMP.cmake
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
set(GMP_PREFIX "" CACHE PATH "path ")
set(GMP_PREFIX
""
CACHE PATH "path ")

list(APPEND CMAKE_MODULE_PATH "/usr/local/lib/cmake/staq")

find_path(GMP_INCLUDE_DIR gmp.h gmpxx.h
PATHS ${GMP_PREFIX}/include /usr/include /usr/local/include
/opt/homebrew/include)
find_path(GMP_INCLUDE_DIR gmp.h gmpxx.h
PATHS ${GMP_PREFIX}/include /usr/include /usr/local/include
/opt/homebrew/include)

find_library(GMP_LIBRARY NAMES gmp libgmp
PATHS ${GMP_PREFIX}/lib /usr/lib /usr/local/lib)
find_library(
GMP_LIBRARY
NAMES gmp libgmp
PATHS ${GMP_PREFIX}/lib /usr/lib /usr/local/lib)

if(GMP_INCLUDE_DIR AND GMP_LIBRARY)
get_filename_component(GMP_LIBRARY_DIR ${GMP_LIBRARY} PATH)
set(GMP_FOUND TRUE)
get_filename_component(GMP_LIBRARY_DIR ${GMP_LIBRARY} PATH)
set(GMP_FOUND TRUE)
endif()

if(GMP_FOUND)
if(NOT GMP_FIND_QUIETLY)
MESSAGE(STATUS "Found GMP: ${GMP_LIBRARY}")
endif()
if(NOT GMP_FIND_QUIETLY)
message(STATUS "Found GMP: ${GMP_LIBRARY}")
endif()
elseif(GMP_FOUND)
if(GMP_FIND_REQUIRED)
message(FATAL_ERROR "Could not find GMP")
endif()
if(GMP_FIND_REQUIRED)
message(FATAL_ERROR "Could not find GMP")
endif()
endif()
8 changes: 8 additions & 0 deletions cmake/pystaq.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# LSP and CMake support for pystaq

if(MSVC)
add_definitions(-DNOMINMAX)
# MSVC lacks <pthread.h>
include_directories(SYSTEM ${STAQ_INSTALL_DIR}/third_party/pthreadwin32)
add_compile_options(/bigobj)
add_compile_options(/utf-8)
endif()

# pybind11
include_directories(SYSTEM ${PYBIND11_INCLUDE_DIRS})
target_include_directories(
Expand Down
10 changes: 4 additions & 6 deletions cmake/staq_msvc.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# MSVC lack of pthread.h
if(MSVC)
add_definitions(-DNOMINMAX)
# MSVC lacks <pthread.h>
include_directories(SYSTEM ${STAQ_INSTALL_DIR}/third_party/pthreadwin32)
endif()

# MSVC bigobj
if(MSVC)
add_compile_options(-bigobj)
add_compile_options(/bigobj)
add_compile_options(/utf-8)
endif()
22 changes: 12 additions & 10 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@ RUN apt-get update && \
ln -fs /usr/share/zoneinfo/America/Toronto /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata

RUN apt-get install -y build-essential python3.10 python3-pip python3-dev \
cmake sudo git vim libgmp-dev

# Install pystaq
RUN pip3 -q install pip --upgrade
RUN pip3 install jupyter matplotlib numpy
RUN pip3 install git+https://github.com/softwareqinc/staq
RUN apt-get install -y build-essential python3 python3-pip python3-dev \
python3-venv cmake sudo git vim libgmp-dev

# Enable a normal user with sudo access
RUN useradd -m -c "softwareQ" sq
RUN echo '%sq ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER sq

# Create a Python 3 virtual environment
RUN python3 -m venv venv

# Install Jupyter and other dependencies, followed by pystaq
COPY requirements.txt ./
RUN . venv/bin/activate && pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir git+https://github.com/softwareqinc/staq

# Clone and install staq
WORKDIR /home/sq
RUN git clone --depth 1 --branch main https://github.com/softwareqinc/staq
WORKDIR /home/sq/staq
RUN cmake -B build -DINSTALL_SOURCES=ON && \
RUN cmake -B build -DINSTALL_SOURCES=ON && \
cmake --build build --target all --parallel 4 && \
sudo cmake --build build --target install
USER sq
WORKDIR /home/sq

# Create a notebook directory for Jupyter
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ docker build -t softwareq-staq .
Run the Jupyter server in a container by executing

```shell
docker run -p8889:8889 -it --workdir=/home/sq/notebooks softwareq-staq sh -c "jupyter notebook --port=8889 --no-browser --ip=0.0.0.0"
docker run -p8889:8889 -it --workdir=/home/sq/notebooks softwareq-staq sh -c ". ~/venv/bin/activate && jupyter notebook --port=8889 --no-browser --ip=0.0.0.0"
```

---
Expand Down
3 changes: 3 additions & 0 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jupyter
matplotlib
numpy
2 changes: 1 addition & 1 deletion examples/standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#
# cmake -B build -DCMAKE_INSTALL_PREFIX=/path/to/installed/staq
#
# then uncomment the following line and replace the installation path with yours
# uncomment the following line and replace the installation path with yours

# set(CMAKE_PREFIX_PATH "/path/to/installed/staq")

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int main(int argc, char** argv) {
std::string input_qasm;

const std::string copyright_notice{
"(c) 2019 - 2024 softwareQ Inc. All rights reserved."};
"(c) 2019 - 2025 softwareQ Inc. All rights reserved."};
CLI::App app{"staq -- A full-stack quantum processing toolkit\n" +
copyright_notice};
app.get_formatter()->label("OPTIONS", "PASSES/OPTIONS");
Expand Down
2 changes: 1 addition & 1 deletion include/staq/gates/channel.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of staq.
*
* Copyright (c) 2019 - 2024 softwareQ Inc. All rights reserved.
* Copyright (c) 2019 - 2025 softwareQ Inc. All rights reserved.
*
* MIT License
*
Expand Down
2 changes: 1 addition & 1 deletion include/staq/grid_synth/complex.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of staq.
*
* Copyright (c) 2019 - 2024 softwareQ Inc. All rights reserved.
* Copyright (c) 2019 - 2025 softwareQ Inc. All rights reserved.
*
* MIT License
*
Expand Down
Loading
Loading