Skip to content

Commit

Permalink
Merge pull request #156 from sfegan/main
Browse files Browse the repository at this point in the history
Support R1v1
  • Loading branch information
sfegan authored Sep 27, 2024
2 parents d1261a2 + 9bf4efd commit fc92d78
Show file tree
Hide file tree
Showing 40 changed files with 1,725 additions and 309 deletions.
69 changes: 50 additions & 19 deletions .github/workflows/singularity-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ on:
- azure-pipelines.yml
- Dockerfile

env:
geant_version: 11.2.2

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
geant: [11.2.2]
arch: [ 'generic', 'ivybridge', 'broadwell', 'cascadelake' ]

runs-on: ${{ matrix.os }}
Expand All @@ -51,17 +53,17 @@ jobs:
libpcap-dev libz-dev libprotobuf-c-dev protobuf-c-compiler \
libprotobuf-dev protobuf-compiler libprotoc-dev libzstd-dev \
build-essential libssl-dev uuid-dev libgpgme11-dev squashfs-tools \
libseccomp-dev pkg-config
libseccomp-dev pkg-config libfuse3-dev
curl -L https://github.com/llr-cta/CTA_ADH_APIS_Build/releases/download/${{matrix.os}}/cta_adh_apis_installed.tgz | sudo tar -zxf - -C /
curl -L https://github.com/llr-cta/Geant4Build/releases/download/${{matrix.os}}-${{matrix.geant}}-OFF/Geant4-${{matrix.os}}-${{matrix.geant}}-OFF.tbz2 | sudo tar -jxf - -C /
curl -L https://github.com/llr-cta/Geant4Build/releases/download/${{matrix.os}}-${{env.geant_version}}-OFF/Geant4-${{matrix.os}}-${{env.geant_version}}-OFF.tbz2 | sudo tar -jxf - -C /
- name: Configure calin
shell: bash
run: |
mkdir mybuild
cd mybuild
cmake -DCALIN_BUILD_ARCH=${{ matrix.arch }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCALIN_PYTHON_SUB_DIR=lib/python3.10 \
-DNO_GEANT4_TEST:BOOLEAN=TRUE \
Expand All @@ -86,12 +88,46 @@ jobs:
sudo find /usr -print > /tmp/files_after.txt
cat /tmp/files_before.txt /tmp/files_after.txt | sort | uniq -u > /tmp/files_added.txt
tar -zcvf /tmp/calin_installed.tgz -C / -T /tmp/files_added.txt
ls -l /tmp/calin_installed.tgz
ls -l /tmp/calin_installed.tgz
- name: Store calin TGZ file
uses: actions/upload-artifact@v4
with:
name: calin_installed_${{matrix.os}}_${{matrix.arch}}
path: /tmp/calin_installed.tgz
retention-days: 5

deploy:
needs: build

strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
arch: [ 'generic', 'ivybridge', 'broadwell', 'cascadelake' ]

runs-on: ${{ matrix.os }}

- name: Set up Go 1.13
steps:
- uses: actions/checkout@v4

- name: Install prerequisites
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y libssl-dev uuid-dev libgpgme11-dev squashfs-tools \
libseccomp-dev pkg-config libfuse3-dev
- name: Retrieve calin TGZ file
uses: actions/download-artifact@v4
with:
name: calin_installed_${{matrix.os}}_${{matrix.arch}}
path: /tmp

- name: Set up Go 1.21.1
uses: actions/setup-go@v5
with:
go-version: 1.13
go-version: 1.21.1
cache: false
id: go

Expand All @@ -101,13 +137,13 @@ jobs:
GOPATH: /tmp/go
run: |
mkdir -p $GOPATH
sudo mkdir -p /usr/local/var/singularity/mnt && \
mkdir -p $GOPATH/src/github.com/sylabs && \
cd $GOPATH/src/github.com/sylabs && \
wget -qO- https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-ce-${SINGULARITY_VERSION}.tar.gz | tar -zxf - && \
cd singularity-ce-${SINGULARITY_VERSION} && \
./mconfig -p /usr/local && \
make -C builddir && \
sudo mkdir -p /usr/local/var/singularity/mnt
mkdir -p $GOPATH/src/github.com/sylabs
cd $GOPATH/src/github.com/sylabs
wget -qO- https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-ce-${SINGULARITY_VERSION}.tar.gz | tar -zxf -
cd singularity-ce-${SINGULARITY_VERSION}
./mconfig -p /usr/local
make -C builddir
sudo make -C builddir install
- name: Build calin singularity container
Expand All @@ -125,8 +161,3 @@ jobs:
run: |
singularity pull calin-pulled.sif oras://ghcr.io/${{ github.repository }}:${{ matrix.arch }}
diff calin-${{ matrix.arch }}.sif calin-pulled.sif
# - uses: actions/upload-artifact@v2
# with:
# name: calin-${{ matrix.arch }}
# path: calin-${{ matrix.arch }}.sif
10 changes: 5 additions & 5 deletions include/diagnostics/waveform_psd_vcl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ template<typename VCLArchitecture> class alignas(VCLArchitecture::vec_bytes) VCL
nsamp_block_ = (nsamp_+num_int16-1)/num_int16;
nsamp_inv_ = 1.0/nsamp_;

calin::util::memory::safe_aligned_recalloc(signal_type_, nchan_);
calin::util::memory::safe_aligned_recalloc(samples_, nsamp_block_*num_int16);
calin::util::memory::safe_aligned_recalloc(waveform_x_, nsamp_);
calin::util::memory::safe_aligned_recalloc(waveform_f_, nsamp_);
calin::util::memory::safe_aligned_recalloc(waveform_p_, nfreq_);
calin::util::memory::safe_aligned_recalloc_and_fill(signal_type_, nchan_);
calin::util::memory::safe_aligned_recalloc_and_fill(samples_, nsamp_block_*num_int16);
calin::util::memory::safe_aligned_recalloc_and_fill(waveform_x_, nsamp_);
calin::util::memory::safe_aligned_recalloc_and_fill(waveform_f_, nsamp_);
calin::util::memory::safe_aligned_recalloc_and_fill(waveform_p_, nfreq_);
calin::util::memory::safe_aligned_recalloc_and_fill(psd_count_hg_, nchan_block_*num_int16);
calin::util::memory::safe_aligned_recalloc_and_fill(dc_sum_hg_, nchan_block_*num_int16);
calin::util::memory::safe_aligned_recalloc_and_fill(psd_sum_hg_, nchan_block_*num_int16 * nfreq_);
Expand Down
6 changes: 6 additions & 0 deletions include/iact_data/acada_data_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ struct ACADA_MessageSet_L0 {
const event_type* event = nullptr;
const header_type* header = nullptr;
const data_stream_type* data_stream = nullptr;

static std::string name() { return "ACADA_MessageSet_L0"; }
};

/*
Expand Down Expand Up @@ -153,6 +155,8 @@ struct ACADA_MessageSet_R1v0 {
const event_type* event = nullptr;
const header_type* header = nullptr;
const data_stream_type* data_stream = nullptr;

static std::string name() { return "ACADA_MessageSet_R1v0"; }
};

/*
Expand Down Expand Up @@ -189,6 +193,8 @@ struct ACADA_MessageSet_R1v1 {
const event_type* event = nullptr;
const header_type* header = nullptr;
const data_stream_type* data_stream = nullptr;

static std::string name() { return "ACADA_MessageSet_R1v1"; }
};

} } } // namespace calin::iact_data::acada_data_source
Expand Down
3 changes: 3 additions & 0 deletions include/iact_data/acada_event_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ void decode_cdts_data(calin::ix::iact_data::telescope_event::CDTSData* calin_cdt
void decode_tib_data(calin::ix::iact_data::telescope_event::TIBData* calin_tib_data,
const AnyArray& cta_array);

void decode_swat_data(calin::ix::iact_data::telescope_event::SWATData* calin_swat_data,
const AnyArray& cta_array);

calin::ix::iact_data::telescope_event::TriggerType determine_trigger_type(
const calin::ix::iact_data::telescope_event::TIBData* calin_tib_data,
const calin::ix::iact_data::telescope_event::CDTSData* calin_cdts_data);
Expand Down
68 changes: 68 additions & 0 deletions include/iact_data/nectarcam_acada_event_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <iact_data/nectarcam_data_source.pb.h>
#include <iact_data/acada_data_source.hpp>
#include <iact_data/acada_event_decoder.hpp>
#include <iact_data/unified_acada_event_decoder.hpp>

namespace calin { namespace iact_data { namespace nectarcam_acada_event_decoder {

Expand Down Expand Up @@ -194,4 +195,71 @@ class NectarCam_ACADACameraEventDecoder_R1v0:
int64_t run_start_time_ = 0;
};

/*
RRRRRRRRRRRRRRRRR 1111111 1111111
R::::::::::::::::R 1::::::1 1::::::1
R::::::RRRRRR:::::R 1:::::::1 1:::::::1
RR:::::R R:::::R111:::::1 111:::::1
R::::R R:::::R 1::::1vvvvvvv vvvvvvv1::::1
R::::R R:::::R 1::::1 v:::::v v:::::v 1::::1
R::::RRRRRR:::::R 1::::1 v:::::v v:::::v 1::::1
R:::::::::::::RR 1::::l v:::::v v:::::v 1::::l
R::::RRRRRR:::::R 1::::l v:::::v v:::::v 1::::l
R::::R R:::::R 1::::l v:::::v v:::::v 1::::l
R::::R R:::::R 1::::l v:::::v:::::v 1::::l
R::::R R:::::R 1::::l v:::::::::v 1::::l
RR:::::R R:::::R111::::::111 v:::::::v 111::::::111
R::::::R R:::::R1::::::::::1 v:::::v 1::::::::::1
R::::::R R:::::R1::::::::::1 v:::v 1::::::::::1
RRRRRRRR RRRRRRR111111111111 vvv 111111111111
*/

class NectarCam_ACADACameraEventDecoder_R1v1:
public calin::iact_data::unified_acada_event_decoder::Unified_ACADACameraEventDecoder_R1v1
{
public:
CALIN_TYPEALIAS(config_type, calin::ix::iact_data::
nectarcam_data_source::NectarCamCameraEventDecoderConfig);

CALIN_TYPEALIAS(message_set_type, calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1);
CALIN_TYPEALIAS(event_type, calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1::event_type);
CALIN_TYPEALIAS(header_type, calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1::header_type);
CALIN_TYPEALIAS(data_stream_type, calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1::data_stream_type);

NectarCam_ACADACameraEventDecoder_R1v1(const std::string& filename,
const config_type& config = default_config());

~NectarCam_ACADACameraEventDecoder_R1v1();

virtual bool decode(
calin::ix::iact_data::telescope_event::TelescopeEvent* event,
const calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1& cta_messages) override;

bool decode_run_config(
calin::ix::iact_data::telescope_run_configuration:: TelescopeRunConfiguration* run_config,
const calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1& cta_messages) override;

NectarCam_ACADACameraEventDecoder_R1v1* clone() const override;

calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig config() const {
return config_;
}

static calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig default_config() {
config_type config = config_type::default_instance();
// config.set_nmc_xml_suffix(".NMC.xml");
config.set_separate_channel_waveforms(true);
return config;
}

protected:
static inline calin::ix::iact_data::cta_data_source::UnifiedCameraEventDecoderConfig unified_decoder_config(
config_type config);
config_type config_;
};


} } } // namespace calin::iact_data::nectarcam_acada_event_decoder
34 changes: 33 additions & 1 deletion include/iact_data/nectarcam_data_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class NectarCamZFITSDataSource_R1v0:
const config_type& config = default_config());
virtual ~NectarCamZFITSDataSource_R1v0();
private:
nectarcam_acada_event_decoder::NectarCam_ACADACameraEventDecoder_R1v0* decoder_;
calin::iact_data::nectarcam_acada_event_decoder::NectarCam_ACADACameraEventDecoder_R1v0* decoder_;
};

/*
Expand All @@ -156,6 +156,38 @@ class NectarCamZFITSDataSource_R1v0:
*/

class NectarCamZFITSDataSource_R1v1:
public calin::iact_data::zfits_data_source::ZFITSDataSource<
calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1>
{
public:
CALIN_TYPEALIAS(config_type,
ZFITSDataSource<calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1>::config_type);
CALIN_TYPEALIAS(decoder_config_type,
calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig);

calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig decoder_config() const {
return decoder_->config(); }

static calin::ix::iact_data::nectarcam_data_source::NectarCamCameraEventDecoderConfig default_decoder_config() {
return calin::iact_data::nectarcam_acada_event_decoder::NectarCam_ACADACameraEventDecoder_R1v1::default_config();
}

NectarCamZFITSDataSource_R1v1(const std::string& filename,
calin::iact_data::zfits_acada_data_source::
ZFITSACADACameraEventDataSource<calin::iact_data::acada_data_source::ACADA_MessageSet_R1v1>* acada_zfits,
const decoder_config_type& decoder_config = default_decoder_config(),
bool adopt_acada_zfits = false);
NectarCamZFITSDataSource_R1v1(const std::string& filename,
const config_type& config,
const decoder_config_type& decoder_config = default_decoder_config());
NectarCamZFITSDataSource_R1v1(const std::string& filename,
const decoder_config_type& decoder_config = default_decoder_config(),
const config_type& config = default_config());
virtual ~NectarCamZFITSDataSource_R1v1();
private:
calin::iact_data::nectarcam_acada_event_decoder::NectarCam_ACADACameraEventDecoder_R1v1* decoder_;
};

/*
Expand Down
10 changes: 4 additions & 6 deletions include/iact_data/parallel_event_dispatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ class ParallelEventDispatcher: protected
calin::ix::provenance::chronicle::ProcessingRecord* processing_record = nullptr;
};

// These functions allow events to be passed on to the visitors - they
// are not meant to be called directly as the visiors expect them to be
// called in a specific order. They are liable to be made private.
void dispatch_run_configuration(calin::ix::iact_data::
telescope_run_configuration::TelescopeRunConfiguration* run_config, bool register_processor);
void dispatch_event(uint64_t seq_index,
Expand All @@ -130,21 +127,22 @@ class ParallelEventDispatcher: protected
calin::io::data_source::DataSourceFactory<
calin::ix::iact_data::telescope_event::TelescopeEvent>* src_factory,
unsigned nthread, unsigned log_frequency,
const std::chrono::system_clock::time_point& start_time,
std::chrono::system_clock::time_point& start_time,
std::atomic<uint_fast64_t>& ndispatched);

void do_dispatcher_loop(
calin::io::data_source::DataSource<
calin::ix::iact_data::telescope_event::TelescopeEvent>* src,
unsigned log_frequency,
unsigned log_frequency, unsigned nevents_to_dispatch,
const std::chrono::system_clock::time_point& start_time,
std::atomic<uint_fast64_t>& ndispatched);

void write_initial_log_message(calin::ix::iact_data::
telescope_run_configuration::TelescopeRunConfiguration* run_config, int nthread);

void write_final_log_message(
unsigned log_frequency, const std::chrono::system_clock::time_point& start_time,
calin::ix::iact_data::telescope_run_configuration::TelescopeRunConfiguration* run_config,
const std::chrono::system_clock::time_point& start_time,
std::atomic<uint_fast64_t>& ndispatched);

std::vector<calin::iact_data::event_visitor::ParallelEventVisitor*> adopted_visitors_;
Expand Down
Loading

0 comments on commit fc92d78

Please sign in to comment.