Skip to content

Commit

Permalink
Use PEP 600 manylinux containers to build pytket (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec committed Jan 8, 2024
1 parent a765aab commit 0594427
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 41 deletions.
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
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

0 comments on commit 0594427

Please sign in to comment.