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

Use PEP 600 manylinux containers to build pytket #1194

Merged
merged 5 commits into from
Jan 4, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/build_libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
- uses: actions/checkout@v4
- name: set up container
run: |
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_x86_64:latest /bin/bash
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_x86_64:latest /bin/bash
docker cp ./libs/${{ matrix.lib }} linux_build:/
docker cp ./libver linux_build:/
docker cp ./.github/workflows/linuxbuildlib linux_build:/
Expand All @@ -123,6 +123,6 @@ jobs:
UPLOAD_PACKAGE=${UPLOAD_PACKAGE}
JFROG_ARTIFACTORY_TOKEN_3=${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }}
JFROG_ARTIFACTORY_USER_3=${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
CONAN_PROFILE=linux-x86_64-gcc10-libstdc++
CONAN_PROFILE=linux-x86_64-gcc12
EOF
docker exec --env-file env-vars linux_build /bin/bash -c "/linuxbuildlib"
8 changes: 4 additions & 4 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:

- name: Set up container
run: |
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_x86_64:latest /bin/bash
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_x86_64:latest /bin/bash
docker cp . linux_build:/tket/

- name: Install and upload packages
run: |
docker start linux_build
docker exec -e JFROG_ARTIFACTORY_TOKEN_3="${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }}" -e JFROG_ARTIFACTORY_USER_3="${{ secrets.JFROG_ARTIFACTORY_USER_3 }}" -e CONAN_PROFILE=linux-x86_64-gcc10-libstdc++ linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildpackages"
docker exec -e JFROG_ARTIFACTORY_TOKEN_3="${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }}" -e JFROG_ARTIFACTORY_USER_3="${{ secrets.JFROG_ARTIFACTORY_USER_3 }}" -e CONAN_PROFILE=linux-x86_64-gcc12 linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildpackages"

build_manylinux_aarch64:
name: Build on manylinux (aarch64)
Expand All @@ -77,14 +77,14 @@ jobs:
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker rm --force -v linux_build
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_aarch64:latest /bin/bash
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_aarch64:latest /bin/bash
docker cp . linux_build:/tket/

- name: Install and upload packages
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker start linux_build
docker exec -e JFROG_ARTIFACTORY_TOKEN_3="${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }}" -e JFROG_ARTIFACTORY_USER_3="${{ secrets.JFROG_ARTIFACTORY_USER_3 }}" -e CONAN_PROFILE=linux-armv8-gcc10-libstdc++ linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildpackages"
docker exec -e JFROG_ARTIFACTORY_TOKEN_3="${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }}" -e JFROG_ARTIFACTORY_USER_3="${{ secrets.JFROG_ARTIFACTORY_USER_3 }}" -e CONAN_PROFILE=linux-armv8-gcc12 linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildpackages"

- name: Remove container
if: always()
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up container
run: |
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_x86_64:latest /bin/bash
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_x86_64:latest /bin/bash
docker cp . linux_build:/tket/
- name: Run build
run: |
docker start linux_build
docker exec -e PY_TAG="cp3${{ matrix.python3-version }}-cp3${{ matrix.python3-version }}" -e CONAN_PROFILE=linux-x86_64-gcc10-libstdc++ linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildwheel"
docker exec -e PY_TAG="cp3${{ matrix.python3-version }}-cp3${{ matrix.python3-version }}" -e CONAN_PROFILE=linux-x86_64-gcc12 linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildwheel"
mkdir wheelhouse
docker cp linux_build:/tket/pytket/audited/. wheelhouse/
- uses: actions/upload-artifact@v4
Expand All @@ -49,13 +49,13 @@ jobs:
- name: Set up container
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_aarch64:latest /bin/bash
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_aarch64:latest /bin/bash
docker cp . linux_build:/tket/
- name: Run build
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker start linux_build
docker exec -e PY_TAG="cp3${{ matrix.python3-version }}-cp3${{ matrix.python3-version }}" -e CONAN_PROFILE=linux-armv8-gcc10-libstdc++ linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildwheel"
docker exec -e PY_TAG="cp3${{ matrix.python3-version }}-cp3${{ matrix.python3-version }}" -e CONAN_PROFILE=linux-armv8-gcc12 linux_build /bin/bash -c "/tket/.github/workflows/linuxbuildwheel"
mkdir wheelhouse
docker cp linux_build:/tket/pytket/audited/. wheelhouse/
- name: Remove container
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:
- name: Set up container
run: |
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_aarch64:latest /bin/bash
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_aarch64:latest /bin/bash
docker cp . linux_build:/tket/
- name: Run tests
run: |
Expand Down
8 changes: 0 additions & 8 deletions conan-profiles/linux-armv8-gcc10-libstdc++

This file was deleted.

8 changes: 8 additions & 0 deletions conan-profiles/linux-armv8-gcc12
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux
8 changes: 0 additions & 8 deletions conan-profiles/linux-x86_64-gcc10-libstdc++

This file was deleted.

8 changes: 8 additions & 0 deletions conan-profiles/linux-x86_64-gcc12
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux
2 changes: 1 addition & 1 deletion pytket/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def package(self):
cmake.install()

def requirements(self):
self.requires("tket/1.2.78@tket/stable")
self.requires("tket/1.2.79@tket/stable")
self.requires("tklog/0.3.3@tket/stable")
self.requires("tkrng/0.3.3@tket/stable")
self.requires("tkassert/0.3.4@tket/stable")
Expand Down
2 changes: 1 addition & 1 deletion tket/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class TketConan(ConanFile):
name = "tket"
version = "1.2.78"
version = "1.2.79"
package_type = "library"
license = "Apache 2"
homepage = "https://github.com/CQCL/tket"
Expand Down
10 changes: 7 additions & 3 deletions tket/src/Circuit/Boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,14 @@ std::string CustomGate::get_name(bool) const {
s << gate_->get_name();
if (!params_.empty()) {
s << "(";
std::string sep = "";
bool initial = true;
for (const Expr &e : params_) {
s << sep << e;
sep = ",";
if (initial) {
s << e;
} else {
s << "," << e;
}
initial = false;
}
s << ")";
}
Expand Down
23 changes: 12 additions & 11 deletions tket/src/Predicates/CompilationUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,28 @@ bool CompilationUnit::check_all_predicates() const {
}

std::string CompilationUnit::to_string() const {
std::string str = "~~~CompilationUnit~~~\n<tket::Circuit qubits=" +
std::to_string(circ_.n_qubits()) +
", gates=" + std::to_string(circ_.n_gates()) + ">\n";
std::stringstream s;
s << "~~~CompilationUnit~~~" << std::endl
<< "<tket::Circuit qubits=" << circ_.n_qubits()
<< ", gates=" << circ_.n_gates() << ">" << std::endl;

if (!target_preds.empty()) {
str += "Target Predicates:\n";
s << "Target Predicates:" << std::endl;
for (const TypePredicatePair& pp : target_preds) {
str += (" " + pp.second->to_string() + "\n");
s << " " << pp.second->to_string() << std::endl;
}
} else
str += "Target Predicates empty\n";
s << "Target Predicates empty" << std::endl;
if (!cache_.empty()) {
str += "Cache:\n";
s << "Cache:" << std::endl;
for (const std::pair<const std::type_index, std::pair<PredicatePtr, bool>>&
tp : cache_) {
str += (" " + tp.second.first->to_string() + " :: ");
str += tp.second.second ? "True\n" : "False\n";
s << " " << tp.second.first->to_string()
<< " :: " << ((tp.second.second) ? "True" : "False") << std::endl;
}
} else
str += "Cache empty\n";
return str;
s << "Cache empty" << std::endl;
return s.str();
}

void CompilationUnit::empty_cache() const { cache_ = {}; }
Expand Down
Loading