Skip to content

Commit

Permalink
split to driver build image, fix no image inference use case.
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkiwi committed Nov 27, 2023
1 parent 91b900f commit b35660b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 65 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ jobs:
- uses: actions/checkout@v4
- name: docker build
run: |
cd docker
docker build -f Dockerfile.vkfft . -t iqtlabs/gamutrf-vkfft:latest
docker build -f Dockerfile.base . -t iqtlabs/gamutrf-base:latest
cd ..
docker build -f docker/Dockerfile.vkfft docker -t iqtlabs/gamutrf-vkfft:latest
docker build -f docker/Dockerfile.driver docker -t iqtlabs/gamutrf-driver:latest
docker build -f docker/Dockerfile.base docker -t iqtlabs/gamutrf-base:latest
docker build -f Dockerfile . -t iqtlabs/gamutrf:latest
docker build -f docker/Dockerfile.torchsig . -t iqtlabs/gamutrf-torchsig:latest
docker run -t iqtlabs/gamutrf:latest gamutrf-scan --help
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ jobs:
push: true
tags: iqtlabs/gamutrf-vkfft:${{ steps.change_version.outputs.VERSION }}
if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push'
- name: Build and push platforms driver
uses: docker/build-push-action@v5
with:
context: docker
file: docker/Dockerfile.driver
platforms: linux/amd64,linux/arm64
push: true
tags: iqtlabs/gamutrf-driver:${{ steps.change_version.outputs.VERSION }}
if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push'
- name: Build and push platforms base
uses: docker/build-push-action@v5
with:
Expand Down
42 changes: 1 addition & 41 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +31,6 @@ COPY --from=iqtlabs/gamutrf-vkfft:latest /root /root/uhd_sample_recorder
WORKDIR /root/uhd_sample_recorder/build
RUN CMAKE_BUILD_TYPE=Release cmake ../lib && make -j $(nproc) && cp uhd_sample_recorder /usr/local/bin

FROM ubuntu:22.04 as driver-builder
COPY --from=iqtlabs/gnuradio:3.10.8 /usr/local /usr/local
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
git \
libbladerf-dev \
libboost-all-dev \
libfftw3-dev \
libgmp-dev \
liblimesuite-dev \
librtlsdr-dev \
libuhd-dev \
libusb-1.0-0-dev \
pkg-config \
unzip \
wget
WORKDIR /root
RUN git clone https://github.com/SignalHound/soapy-bb60
RUN git clone https://github.com/pothosware/SoapyBladeRF -b soapy-bladerf-0.4.1
RUN git clone https://github.com/pothosware/SoapyRTLSDR -b soapy-rtl-sdr-0.3.3
RUN git clone https://github.com/pothosware/SoapyUHD -b soapy-uhd-0.4.1
RUN git clone https://github.com/Nuand/bladeRF.git -b 2023.02
RUN git clone https://github.com/anarkiwi/lime-tools -b samples
RUN wget https://signalhound.com/sigdownloads/SDK/signal_hound_sdk_08_25_23.zip -Osdk.zip && unzip sdk.zip && rm sdk.zip
WORKDIR /root/soapy-bb60/SoapyBB60C/build
RUN if [ "$(arch)" = "x86_64" ] ; then cp /root/signal_hound_sdk/device_apis/bb_series/include/* /usr/local/include/ && cp /root/signal_hound_sdk/device_apis/bb_series/lib/linux/Ubuntu*18.04/* /usr/local/lib && ldconfig -v -n /usr/local/lib && ln -sf /usr/local/lib/libbb_api.so.5 /usr/local/lib/libbb_api.so && cmake .. && make -j "$(nproc)" && make install ; fi
WORKDIR /root/SoapyBladeRF/build
RUN cmake .. && make -j "$(nproc)" && make install
WORKDIR /root/SoapyRTLSDR/build
RUN cmake .. && make -j "$(nproc)" && make install
WORKDIR /root/SoapyUHD/build
RUN cmake .. && make -j "$(nproc)" && make install
WORKDIR /root/bladeRF/host/build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DINSTALL_UDEV_RULES=ON -DENABLE_BACKEND_LIBUSB=TRUE .. && make -j "$(nproc)" && make install
WORKDIR /root/lime-tools/build
RUN cmake .. && make install

FROM ubuntu:22.04 as gr-iqtlabs-builder
COPY --from=iqtlabs/gnuradio:3.10.8 /usr/local /usr/local
ENV DEBIAN_FRONTEND noninteractive
Expand Down Expand Up @@ -112,7 +72,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3-numpy \
&& apt-get -y -q clean && rm -rf /var/lib/apt/lists/*
COPY --from=iqtlabs/gnuradio:3.10.8 /usr/local /usr/local
COPY --from=driver-builder /usr/local /usr/local
COPY --from=iqtlabs/gamutrf-driver /usr/local /usr/local
COPY --from=gr-iqtlabs-builder /usr/local /usr/local
COPY --from=uhd_sample_recorder-builder /usr/local /usr/local
RUN ldconfig -v
Expand Down
41 changes: 41 additions & 0 deletions docker/Dockerfile.driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM ubuntu:22.04 as driver-builder
COPY --from=iqtlabs/gnuradio:3.10.8 /usr/local /usr/local
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
git \
libbladerf-dev \
libboost-all-dev \
libfftw3-dev \
libgmp-dev \
liblimesuite-dev \
librtlsdr-dev \
libuhd-dev \
libusb-1.0-0-dev \
pkg-config \
unzip \
wget
WORKDIR /root
RUN git clone https://github.com/SignalHound/soapy-bb60
RUN git clone https://github.com/pothosware/SoapyBladeRF -b soapy-bladerf-0.4.1
RUN git clone https://github.com/pothosware/SoapyRTLSDR -b soapy-rtl-sdr-0.3.3
RUN git clone https://github.com/pothosware/SoapyUHD -b soapy-uhd-0.4.1
RUN git clone https://github.com/Nuand/bladeRF.git -b 2023.02
RUN git clone https://github.com/anarkiwi/lime-tools -b samples
RUN wget https://signalhound.com/sigdownloads/SDK/signal_hound_sdk_08_25_23.zip -Osdk.zip && unzip sdk.zip && rm sdk.zip
WORKDIR /root/soapy-bb60/SoapyBB60C/build
RUN if [ "$(arch)" = "x86_64" ] ; then cp /root/signal_hound_sdk/device_apis/bb_series/include/* /usr/local/include/ && cp /root/signal_hound_sdk/device_apis/bb_series/lib/linux/Ubuntu*18.04/* /usr/local/lib && ldconfig -v -n /usr/local/lib && ln -sf /usr/local/lib/libbb_api.so.5 /usr/local/lib/libbb_api.so && cmake .. && make -j "$(nproc)" && make install ; fi
WORKDIR /root/SoapyBladeRF/build
RUN cmake .. && make -j "$(nproc)" && make install
WORKDIR /root/SoapyRTLSDR/build
RUN cmake .. && make -j "$(nproc)" && make install
WORKDIR /root/SoapyUHD/build
RUN cmake .. && make -j "$(nproc)" && make install
WORKDIR /root/bladeRF/host/build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DINSTALL_UDEV_RULES=ON -DENABLE_BACKEND_LIBUSB=TRUE .. && make -j "$(nproc)" && make install
WORKDIR /root/lime-tools/build
RUN cmake .. && make install
FROM ubuntu:22.04
COPY --from=driver-builder /usr/local /usr/local
43 changes: 23 additions & 20 deletions gamutrf/grscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,30 +188,33 @@ def __init__(
logging.info("serving FFT on %s", zmq_addr)
self.fft_blocks.append((zeromq.pub_sink(1, 1, zmq_addr, 100, False, 65536, "")))

self.inference_blocks = []
if inference_output_dir:
x = 640
y = 640
Path(inference_output_dir).mkdir(parents=True, exist_ok=True)
self.inference_blocks = [
self.iqtlabs.image_inference(
tag="rx_freq",
vlen=nfft,
x=x,
y=y,
image_dir=inference_output_dir,
convert_alpha=255,
norm_alpha=0,
norm_beta=1,
norm_type=32, # cv::NORM_MINMAX = 32
colormap=16, # cv::COLORMAP_VIRIDIS = 16, cv::COLORMAP_TURBO = 20,
interpolation=1, # cv::INTER_LINEAR = 1,
flip=0, # 0 means flipping around the x-axis
min_peak_points=inference_min_db,
model_server=inference_model_server,
model_name=inference_model_name,
confidence=inference_min_confidence,
)
]
self.inference_blocks.extend(
[
self.iqtlabs.image_inference(
tag="rx_freq",
vlen=nfft,
x=x,
y=y,
image_dir=inference_output_dir,
convert_alpha=255,
norm_alpha=0,
norm_beta=1,
norm_type=32, # cv::NORM_MINMAX = 32
colormap=16, # cv::COLORMAP_VIRIDIS = 16, cv::COLORMAP_TURBO = 20,
interpolation=1, # cv::INTER_LINEAR = 1,
flip=0, # 0 means flipping around the x-axis
min_peak_points=inference_min_db,
model_server=inference_model_server,
model_name=inference_model_name,
confidence=inference_min_confidence,
)
]
)
if mqtt_server:
self.inference_blocks.extend(
[
Expand Down

0 comments on commit b35660b

Please sign in to comment.