Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a0ed996
Rewrite of PMTs to use variants.
jsallay Nov 29, 2022
a13ed1f
Merge branch 'main' of https://github.com/gnuradio/pmt
jsallay Dec 17, 2022
087e08b
Add missing includes and install base64 to right place
mormj Jan 5, 2023
520e9bd
Remove debug print in buffer_to_pmt
mormj Jan 12, 2023
0fd29b7
Switch vector to Tensor class
jsallay Jul 26, 2025
14616eb
Try to make github ci happy
jsallay Jul 26, 2025
79b835b
Fix some python errors
jsallay Jul 26, 2025
d43ea09
Fix a few more issues
jsallay Jul 26, 2025
e2189ba
Try adding a forward declaration
jsallay Jul 26, 2025
0e48a85
Make Tensor operator==/!= use references
jsallay Jul 26, 2025
add1dd9
Add a spaceship operator to tensor???
jsallay Jul 26, 2025
c4bb094
Try explicit definition for spaceship operator
jsallay Jul 26, 2025
30cc126
[PATCH] expanded Tensor<T>
RalphSteinhagen Aug 25, 2025
8a2efac
\[PATCH] Tensor<T>: consteval-first refactor,
RalphSteinhagen Aug 26, 2025
122c1c3
Merge pull request #8 from RalphSteinhagen/add-tensor
jsallay Aug 29, 2025
0431482
Merge remote-tracking branch 'origin/main' into add-tensor
jsallay Aug 29, 2025
747f214
Merge remote-tracking branch 'base/main' into add-tensor
jsallay Aug 29, 2025
a817de0
Forgot to save a file
jsallay Aug 29, 2025
00ec2b9
Forgot to save a file
jsallay Aug 29, 2025
1e0c2e7
Update ubuntu image
jsallay Sep 6, 2025
1c1c69d
Attempt to build an image in this repo
jsallay Sep 8, 2025
fa10b05
Fix typo in ci file
jsallay Sep 8, 2025
3c6e764
Fix a few more issues with ci
jsallay Sep 8, 2025
1a287fd
Add path for dockerfile to job
jsallay Sep 8, 2025
9f0fd0a
Try to fix dockerfile path problem
jsallay Sep 8, 2025
ca62932
Try again
jsallay Sep 8, 2025
394f66b
Use dockerfile path relative to context
jsallay Sep 8, 2025
4c5db02
Try to fix change detection
jsallay Sep 8, 2025
455cb69
Fix Dockerfile installs
jsallay Sep 8, 2025
c13cf04
Fix Dockerfile installs
jsallay Sep 8, 2025
e74a398
Merge emscripten with other builds
jsallay Sep 8, 2025
f75d6ab
Try something random
jsallay Sep 8, 2025
415b78e
Try something random
jsallay Sep 8, 2025
3a3c691
Push image to an org that is owned
jsallay Sep 8, 2025
8e41cbc
Revert last change
jsallay Sep 9, 2025
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
138 changes: 134 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,60 @@ on:
branches:
- main
jobs:
buildAndPublishDocker:
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
include:
- path: Dockerfile.ubuntu
tag: ubuntu-24.04
- path: Dockerfile.fedora
tag: fedora-42
name: "Update ${{ matrix.tag }}"
environment: github-action-autobuild

outputs:
container: ghcr.io/gnuradio/pmt-build-container:${{ matrix.tag }}

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check if dockerfile was modified
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
docker:
- docker/${{ matrix.path }}

- name: Set up Docker Buildx
if: steps.changes.outputs.docker == 'true'
uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
if: steps.changes.outputs.docker == 'true'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v5
if: steps.changes.outputs.docker == 'true'
with:
context: "{{defaultContext}}:docker"
push: true
tags: ghcr.io/gnuradio/pmt-build-container:${{ matrix.tag }}
file: ${{ matrix.path }}
linux-docker:
# All of these shall depend on the formatting check (needs: check-formatting)
runs-on: ubuntu-24.04
needs: buildAndPublishDocker
# The GH default is 360 minutes (it's also the max as of Feb-2021). However,
# we should fail sooner. The only reason to exceed this time is if a test
# hangs.
Expand All @@ -24,10 +75,10 @@ jobs:
# container (i.e., what you want to docker-pull)
distro:
- name: 'Ubuntu 24.04'
containerid: 'ghcr.io/gnuradio/gnuradio-docker:ubuntu-24.04'
containerid: 'ghcr.io/gnuradio/pmt-build-container:ubuntu-24.04'
cxxflags: -Werror
- name: 'Fedora 40'
containerid: 'ghcr.io/gnuradio/gnuradio-docker:fedora-40'
- name: 'Fedora 42'
containerid: 'ghcr.io/gnuradio/pmt-build-container:fedora-42'
cxxflags: ''
# - distro: 'CentOS 8.3'
# containerid: 'gnuradio/ci:centos-8.3-3.9'
Expand All @@ -37,7 +88,7 @@ jobs:
# cxxflags: -Werror
compiler:
- name: "gcc"
command: "g++"
command: "g++-14"
- name: "clang"
command: "clang++"
name: ${{ matrix.distro.name }} - ${{ matrix.compiler.name }}
Expand Down Expand Up @@ -65,3 +116,82 @@ jobs:
with:
name: Linux_Meson_Testlog
path: build/meson-logs/testlog.txt
emscripten-docker:
# All of these shall depend on the formatting check (needs: check-formatting)
runs-on: ubuntu-24.04
needs: buildAndPublishDocker
# The GH default is 360 minutes (it's also the max as of Feb-2021). However,
# we should fail sooner. The only reason to exceed this time is if a test
# hangs.
timeout-minutes: 120
strategy:
# Enabling fail-fast would kill all Dockers if one of them fails. We want
# maximum output.
fail-fast: false
matrix:
# For every distro we want to test here, add one key 'distro' with a
# descriptive name, and one key 'containerid' with the name of the
# container (i.e., what you want to docker-pull)
distro:
- name: 'Ubuntu 24.04'
containerid: 'ghcr.io/gnuradio/pmt-build-container:ubuntu-24.04'
cxxflags: -Werror
compiler:
- name: "emscripten"
command: "emcc"
base: "g++-14"
name: ${{ matrix.distro.name }} - ${{ matrix.compiler.name }}
container:
image: ${{ matrix.distro.containerid }}
volumes:
- build_data:/build
options: --cpus 2
steps:
- uses: actions/checkout@v4
name: Checkout Project
- name: Install emscripten
run: |
DEBIAN_FRONTEND=noninteractive apt-get install -qy bzip2 clang
cd
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
# Download and install the latest SDK tools.
./emsdk install latest
# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

# - name: Install emscripten
# run: |
# pwd
# echo
# ls ${{ github.workspace }}
# echo
# ls .
# echo
# ls emsdk
- name: Configure Meson
shell: bash
working-directory: ${{ github.workspace }}
env:
CXX: ${{ matrix.compiler.base }}
run: |
source ~/emsdk/emsdk_env.sh
tee emscripten-toolchain.ini <<EOF >/dev/null
[constants]
toolchain = '$HOME/emsdk/${{ env.EM_CACHE_FOLDER }}/upstream/emscripten/'
EOF
meson setup build --cross-file emscripten-toolchain.ini --cross-file emscripten-build.ini -Denable_python=false -Denable_testing=false
- name: Make
working-directory: ${{ github.workspace }}/build
run: 'ninja'
- name: Run Test File
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
source ~/emsdk/emsdk_env.sh
${EMSDK_NODE} bench/bm_pmt_dict_ref.js
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Linux_Meson_Testlog
path: build/meson-logs/testlog.txt
84 changes: 0 additions & 84 deletions .github/workflows/emscripten.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PMT Objects represent a serializable container of data that can be passed across

- meson
- ninja
- C++20
- C++23

## Installation

Expand Down
1 change: 0 additions & 1 deletion bench/bm_pmt_dict_pack_unpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#pragma GCC diagnostic push // ignore warning of external libraries that from this lib-context we do not have any control over
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
#ifndef __clang__ // only for GCC, not Clang
#pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
Expand Down
1 change: 0 additions & 1 deletion bench/bm_pmt_dict_ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#pragma GCC diagnostic push // ignore warning of external libraries that from this lib-context we do not have any control over
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
#ifndef __clang__ // only for GCC, not Clang
#pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
Expand Down
4 changes: 2 additions & 2 deletions bench/bm_pmt_serialize_uvec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma GCC diagnostic push // ignore warning of external libraries that from this lib-context we do not have any control over
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
#ifndef __clang__ // only for GCC, not Clang
#pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
Expand All @@ -27,12 +26,13 @@ using namespace pmtv;
bool run_test(const int32_t times, const std::vector<int32_t>& data)
{
bool valid = true;
Tensor<int32_t> tdata(pmtv::data_from, data);

std::stringbuf sb; // fake channel
for (int i = 0; i < times; i++) {
sb.str(""); // reset channel to empty
// auto p1 = vector<int32_t>(data);
pmt p1 = data;
pmt p1 = tdata;
pmtv::serialize(sb, p1);
auto p2 = pmtv::deserialize(sb);
if (p1 != p2)
Expand Down
13 changes: 13 additions & 0 deletions docker/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM fedora:42

RUN sudo dnf upgrade -y && \
sudo dnf install -y \
gcc-c++ \
clang \
meson \
ninja-build \
python3-devel \
gtest-devel \
cli11-devel \
git \
fmt-devel
7 changes: 7 additions & 0 deletions docker/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -y g++-14 clang-18 meson ninja-build python3-dev libgtest-dev libcli11-dev software-properties-common git

RUN apt update && apt install -y libfmt-dev
10 changes: 8 additions & 2 deletions include/pmtv/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <fmt/ranges.h>

namespace fmt {

// Forward declaration
template<pmtv::IsPmt P> struct formatter<P>;

template <>
struct formatter<pmtv::map_t::value_type> {
template <typename ParseContext>
Expand Down Expand Up @@ -34,7 +38,6 @@ struct formatter<C> {
}
};


template<pmtv::IsPmt P>
struct formatter<P>
{
Expand All @@ -53,7 +56,10 @@ struct formatter<P>
return fmt::format_to(ctx.out(), "{}", arg);
else if constexpr (std::same_as<T, std::string>)
return fmt::format_to(ctx.out(), "{}", arg);
else if constexpr (UniformVector<T> || UniformStringVector<T>)
else if constexpr (PmtTensor<T>) {
// Difficult to format an N-dim Tensor. Figure out something eventually.
return fmt::format_to(ctx.out(), "[{}]", fmt::join(arg.data_span(), ", "));
} else if constexpr (UniformStringVector<T>)
return fmt::format_to(ctx.out(), "[{}]", fmt::join(arg, ", "));
else if constexpr (std::same_as<T, std::vector<pmt>>) {
return fmt::format_to(ctx.out(), "[{}]", fmt::join(arg, ", "));
Expand Down
14 changes: 10 additions & 4 deletions include/pmtv/pmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace pmtv {
using map_t = std::map<std::string, pmt, std::less<>>;

template<class T>
inline constexpr std::in_place_type_t<std::vector<T>> vec_t{};
inline constexpr std::in_place_type_t<Tensor<T>> tensor_t{};

template<typename T>
concept IsPmt = std::is_same_v<T, pmt>;
Expand All @@ -23,14 +23,20 @@ namespace pmtv {
// auto get_vector(V value) -> decltype(std::get<std::vector<T>>(value) {
// return std::get<std::vector<T>>(value);
// }

template <IsPmt V>
std::vector<pmt>& get_pmt_vector(V& value ) {
return std::get<std::vector<pmtv::pmt>>(value);
}

template<class T, class V>
std::vector<T> &get_vector(V &value) {
return std::get<std::vector<T>>(value);
std::vector<T> &get_tensor(V& value) {
return std::get<pmtv::Tensor<T>>(value);
}

template<class T, class V>
std::span<T> get_span(V &value) {
return std::span(std::get<std::vector<T>>(value));
return std::get<pmtv::Tensor<T>>(value).data_span();
}

template<class V>
Expand Down
Loading
Loading