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
1 change: 1 addition & 0 deletions .github-ci.yaml
54 changes: 49 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ jobs:
id: cache
with:
key: raw_test_data # fixed key will always hit; clear cache to trigger cache miss
path: clas_005038.evio.00000
path: |
clas_005038.evio.00000
clas_021559.evio.00001
lookup-only: true
- name: install xrootd-client
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
Expand All @@ -50,6 +52,7 @@ jobs:
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
xrdcp xroot://sci-xrootd.jlab.org///osgpool/hallb/clas12/validation/clas_005038.evio.00000 ./
xrdcp xroot://sci-xrootd.jlab.org///osgpool/hallb/clas12/validation/raw/rg-l/clas_021559.evio.00001 ./

# build
#############################################################################
Expand Down Expand Up @@ -86,14 +89,18 @@ jobs:
if: ${{ github.ref_type == 'tag' }}
run: libexec/version-bump.sh ${{ github.ref_name }}
- name: build
run: ./build-coatjava.sh --xrootd --no-progress -T${{ env.nthreads }}
run: ./build-coatjava.sh --clara --xrootd --no-progress -T${{ env.nthreads }}
- name: tar # tarball to preserve permissions
run: tar czvf coatjava.tar.gz coatjava
run: |
tar czvf coatjava.tar.gz coatjava
tar czvf clara.tar.gz clara
- uses: actions/upload-artifact@v4
with:
name: build_${{ matrix.runner }}
retention-days: 1
path: coatjava.tar.gz
path: |
coatjava.tar.gz
clara.tar.gz

# tests
#############################################################################
Expand Down Expand Up @@ -147,13 +154,50 @@ jobs:
- uses: actions/cache/restore@v4
with:
key: raw_test_data
path: clas_005038.evio.00000
path: |
clas_005038.evio.00000
clas_021559.evio.00001
- name: untar build
run: tar xzvf coatjava.tar.gz
- name: run test
run: |
ls -lhtr
./coatjava/bin/decoder -n 10000 -o dog.hipo ./clas_005038.evio.00000

test_clara:
needs: [ build, download_test_data ]
strategy:
fail-fast: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: ${{ env.java_version }}
distribution: ${{ env.java_distribution }}
- name: setup cvmfs
uses: cvmfs-contrib/github-action-cvmfs@v5
with:
cvmfs_repositories: 'oasis.opensciencegrid.org'
- uses: actions/download-artifact@v5
with:
name: build_ubuntu-latest
- uses: actions/cache/restore@v4
with:
key: raw_test_data
path: |
clas_005038.evio.00000
clas_021559.evio.00001
- name: untar build
run: |
tar xzvf clara.tar.gz
- name: run test
run: |
ls -lhtr
./clara/plugins/clas12/bin/run-clara -y ./etc/services/rgl-clarode.yml -t ${{ env.nthreads }} -n 200 -c ./clara -o ./tmp ./clas_021559.evio.00001
ls -lhtr

test_coatjava:
needs: [ build ]
strategy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# installed:
/coatjava
/clara
target
/publish
/docs/javadoc/*
Expand Down
28 changes: 27 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ stages:
build:
stage: build
script:
- ./build-coatjava.sh -T$JL_RUNNER_AVAIL_CPU --quiet --no-progress
- ./build-coatjava.sh --clara -T$JL_RUNNER_AVAIL_CPU --quiet --no-progress
- tar -czf coatjava.tar.gz coatjava
- tar -czf clara.tar.gz clara
artifacts:
when: always
expire_in: 1 day
paths:
- coatjava.tar.gz
- clara.tar.gz

depana:
allow_failure: true
Expand All @@ -38,6 +40,18 @@ depana:
- libexec/dependency-tree.sh
- libexec/dependency-analysis.sh

download:
stage: build
script:
- xrdcp xroot://sci-xrootd.jlab.org///osgpool/hallb/clas12/validation/clas_005038.evio.00000 ./
- xrdcp xroot://sci-xrootd.jlab.org///osgpool/hallb/clas12/validation/raw/rg-l/clas_021559.evio.00001 ./
artifacts:
when: always
expire_in: 1 day
paths:
- clas_005038.evio.00000
- clas_021559.evio.00000

spotbugs:
stage: test
needs: [build]
Expand Down Expand Up @@ -100,6 +114,18 @@ eb:
- ARG: electronneutronC
- ARG: electronFTpion

clara:
allow_failure: true
stage: test
needs: [build]
dependencies: [build]
script:
- >
tar -xzf clara.tar.gz &&
./clara/plugins/clas12/bin/run-clara -c ./clara
-t $JL_RUNNER_AVAIL_CPU -y ./etc/services/rgl-clarode.yml
-n 100 -o ./out clas_021*.hipo

profile:
stage: test
needs: [build]
Expand Down
2 changes: 1 addition & 1 deletion bin/run-clara
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ done
[ $(cat $CLARA_USER_DATA/filelist.txt | wc -l) -gt 0 ] || error "Found no input files"

# Set some JVM options:
export JAVA_OPTS="$JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions"
export JAVA_OPTS="$JAVA_OPTS -Xmx${threads}g -XX:+IgnoreUnrecognizedVMOptions"
export JAVA_OPTS="$JAVA_OPTS -Djava.io.tmpdir=$CLARA_USER_DATA -Dorg.sqlite.tmpdir=$CLARA_USER_DATA"
# Set verbosity:
[ -z ${quiet+x} ] && stub=fine || stub=info
Expand Down
59 changes: 59 additions & 0 deletions etc/services/rgl-clarode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
mime-types:
- binary/data-hipo
configuration:
global:
variation: rge_spring2024
timestamp: 10/08/2025-17:00:00
io-services:
writer:
schema_dir: full
services:
MAGFIELDS:
magfieldSolenoidMap: Symm_solenoid_r601_phi1_z1201_13June2018.dat
magfieldTorusMap: Full_torus_r251_phi181_z251_25Jan2021.dat
io-services:
reader:
class: org.jlab.io.clara.DecoderReader
name: DecoderReader
writer:
class: org.jlab.io.clara.DecoderWriter
name: DecoderWriter
services:
- class: org.jlab.service.ai.DCDenoiseEngine
name: DCDN
- class: org.jlab.clas.swimtools.MagFieldsEngine
name: MAGFIELDS
- class: org.jlab.rec.ft.cal.FTCALEngine
name: FTCAL
- class: org.jlab.rec.ft.hodo.FTHODOEngine
name: FTHODO
- class: org.jlab.rec.ft.FTEBEngine
name: FTEB
- class: org.jlab.service.dc.DCHBClustering
name: DCCR
- class: org.jlab.service.dc.DCHBPostClusterConv
name: DCHB
- class: org.jlab.service.ftof.FTOFHBEngine
name: FTOFHB
- class: org.jlab.service.ec.ECEngine
name: EC
- class: org.jlab.service.ctof.CTOFEngine
name: CTOF
- class: org.jlab.service.cnd.CNDCalibrationEngine
name: CND
- class: org.jlab.service.band.BANDEngine
name: BAND
- class: org.jlab.service.htcc.HTCCReconstructionService
name: HTCC
- class: org.jlab.service.ltcc.LTCCEngine
name: LTCC
- class: org.jlab.service.eb.EBHBEngine
name: EBHB
- class: org.jlab.service.dc.DCTBEngine
name: DCTB
- class: org.jlab.service.ftof.FTOFTBEngine
name: FTOFTB
- class: org.jlab.service.eb.EBTBEngine
name: EBTB
- class: org.jlab.rec.rich.RICHEBEngine
name: RICH
3 changes: 1 addition & 2 deletions install-clara
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function litter() {
then
echo -e "\nSee temporary build directory for more info:\n\t$tmp_dir"
else
rm -rf $tmp_dir && echo -e "\nRemoved temporary build directory:\n\t$tmp_dir"
rm -rf $tmp_dir
fi
fi
}
Expand Down Expand Up @@ -117,7 +117,6 @@ fi
tmp_dir=$(mktemp -d tmp.install-clara.XXXXXX)
[ $? -ne 0 ] && error "Cannot create temporary directory: $tmp_dir"
tmp_dir=$(cd $tmp_dir && pwd)
echo -e "\nCreating temporary build directory:\n\t$tmp_dir"
cd $tmp_dir

# CLARA:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import ai.djl.translate.TranslateException;
import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ArrayBlockingQueue;

import org.jlab.clas.reco.ReconstructionEngine;
import org.jlab.io.base.DataBank;
Expand All @@ -28,6 +28,7 @@ public class DCDenoiseEngine extends ReconstructionEngine {

final static String[] BANK_NAMES = {"DC::tot","DC::tdc"};
final static String CONF_THRESHOLD = "threshold";
final static String CONF_THREADS = "threads";
final static int LAYERS = 36;
final static int WIRES = 112;

Expand All @@ -39,11 +40,11 @@ public class DCDenoiseEngine extends ReconstructionEngine {
public static class PredictorPool {
final BlockingQueue<Predictor> pool;
public PredictorPool(int size, ZooModel model) {
pool = new LinkedBlockingQueue<>(size);
for (int i=0; i<size; i++) pool.offer(model.newPredictor());
pool = new ArrayBlockingQueue<>(size);
for (int i=0; i<size; i++) pool.add(model.newPredictor());
}
public Predictor get() throws InterruptedException {
return pool.take();
return pool.poll();
}
public void put(Predictor p) {
if (p != null) pool.offer(p);
Expand All @@ -56,6 +57,9 @@ public DCDenoiseEngine() {

@Override
public boolean init() {
System.setProperty("ai.djl.pytorch.num_interop_threads", "1");
System.setProperty("ai.djl.pytorch.num_threads", "1");
System.setProperty("ai.djl.pytorch.graph_optimizer", "false");
if (getEngineConfigString(CONF_THRESHOLD) != null)
threshold = Float.parseFloat(getEngineConfigString(CONF_THRESHOLD));
try {
Expand All @@ -67,14 +71,23 @@ public boolean init() {
.optProgress(new ProgressBar())
.build();
model = criteria.loadModel();
predictors = new PredictorPool(64, model);
int threads = Integer.parseInt(getEngineConfigString(CONF_THREADS,"64"));
predictors = new PredictorPool(threads, model);
return true;
} catch (NullPointerException | MalformedModelException | IOException | ModelNotFoundException ex) {
System.getLogger(DCDenoiseEngine.class.getName()).log(System.Logger.Level.ERROR, (String) null, ex);
return false;
}
}

public static void main(String args[]){
DCDenoiseEngine dn = new DCDenoiseEngine();
dn.init();
for (int i=0; i<10000; i++) {
dn.processFakeEvent();
}
}

@Override
public boolean processDataEvent(DataEvent event) {

Expand Down