Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run works locally. Problem in ports UI: integer types don't show corr… #1

Merged
merged 3 commits into from
Jun 26, 2023
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
9 changes: 4 additions & 5 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

KWAVE_LOGIN: ${{ secrets.KWAVE_LOGIN }}
KWAVE_PASSWORD: ${{ secrets.KWAVE_PASSWORD }}
jobs:
build:
name: building k-wave
Expand Down Expand Up @@ -39,14 +40,12 @@ jobs:
make VERSION
make build
make info-build
- name: test
run: make tests
- if: github.event_name == 'push' && github.ref == 'refs/heads/master'
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
name: push
run: |
./.github/dockerhub_login.bash
make push
- if: github.event_name == 'push' && github.ref != 'refs/heads/master'
- if: github.event_name == 'push' && github.ref != 'refs/heads/main'
name: push
run: |
./.github/dockerhub_login.bash
Expand Down
3 changes: 3 additions & 0 deletions .osparc/docker-compose.overwrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ services:
build:
dockerfile: docker/custom/Dockerfile
target: production
args:
- KWAVE_LOGIN
Copy link
Member

@pcrespov pcrespov Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are you passing these?? They should go as environs on the service, no? Perhaps you should use oenvs for that... It is under development in ITISFoundation/osparc-simcore#3565

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope @pcrespov, I don't think this are environs of the service.
I use them during building to download the executable of this tool from a website that requires login. See here:
https://github.com/ITISFoundation/k-wave/blob/first_version/docker/custom/Dockerfile#L49

- KWAVE_PASSWORD
131 changes: 120 additions & 11 deletions .osparc/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ key: simcore/services/comp/k-wave
type: computational
integration-version: 1.0.0
version: 1.0.0
description: A MATLAB toolbox for the time-domain simulation of acoustic wave fields. It uses the kspaceFirst3DG function to run 3D time-domain simulation of wave propagation on a GPU using C++ CUDA code.
description: k-Wave is a MATLAB toolbox for the time-domain simulation of acoustic wave fields. This service uses the kspaceFirstOrder-CUDA function to run 3D time-domain simulation of wave propagation on a GPU using C++ CUDA code (k-Wave version 1.3). <br><br> Have an issue? Create one at https://github.com/ITISFoundation/k-wave/issues
contact: [email protected]
thumbnail: https://pbs.twimg.com/media/ER4wiXEWkAAY-GD.jpg
authors:
Expand All @@ -13,19 +13,128 @@ authors:
inputs:
input_1:
displayOrder: 1
label: input_1_label
description: The input 1 description
type: string
defaultValue: some_value(optional)
label: Input HDF5
description: Compatible HDF5 file (check [k-Wave User Manual](http://www.k-wave.org/manual/k-wave_user_manual_1.1.pdf) to know how to create it.)
type: data:*/*
fileToKeyMap:
somefilename.ext: input_1

input.h5: input_1
input_2:
displayOrder: 2
label: Compression level
description: Compression level (-c)
defaultValue: 0
type: ref_contentSchema
contentSchema:
title: Compression level
type: integer
minimum: 0
maximum: 9
input_3:
displayOrder: 3
label: Store p_rms
description: Store rms of p (acoustic pressure)
type: boolean
defaultValue: false
input_4:
displayOrder: 4
label: Store p_max
description: Store max of p (acoustic pressure)
type: boolean
defaultValue: false
input_5:
displayOrder: 5
label: Store p_min
description: Store min of p (acoustic pressure)
type: boolean
defaultValue: false
input_6:
displayOrder: 6
label: Store p_max_all
description: Store max of p (whole domain)
type: boolean
defaultValue: false
input_7:
displayOrder: 7
label: Store p_min_all
description: Store min of p (acoustic pressure)
type: boolean
defaultValue: false
input_8:
displayOrder: 8
label: Store p_final
description: Store final pressure field
type: boolean
defaultValue: false
input_9:
displayOrder: 9
label: Store u
description: Store ux, uy, uz
type: boolean
defaultValue: false
input_10:
displayOrder: 10
label: Store u_non_staggered_raw
description: Store non-staggered raw time series of ux, uy, uz
type: boolean
defaultValue: false
input_11:
displayOrder: 11
label: Store u_rms
description: Store rms of ux, uy, uz
type: boolean
defaultValue: false
input_12:
displayOrder: 12
label: Store u_max
description: Store max of ux, uy, uz
type: boolean
defaultValue: false
input_13:
displayOrder: 13
label: Store u_min
description: Store min of ux, uy, uz
type: boolean
defaultValue: false
input_14:
displayOrder: 14
label: Store u_max_all
description: Store max of ux, uy, uz (whole domain)
type: boolean
defaultValue: false
input_15:
displayOrder: 15
label: Store u_min_all
description: Store min of ux, uy, uz (whole domain)
type: boolean
defaultValue: false
input_16:
displayOrder: 16
label: Store u_final
description: Store final acoustic velocity
type: boolean
defaultValue: false
input_17:
displayOrder: 17
label: Start of data collection
description: Time step when data collection begins (-s)
defaultValue: 1
type: ref_contentSchema
contentSchema:
title: Start of data collection
type: integer
input_18:
displayOrder: 18
label: Copy sensory mask
description: Copy sensor mask to the output file
type: boolean
defaultValue: fals

outputs:
output_1:
displayOrder: 1
label: output_1_label
description: The input 1 description
type: string
label: Output HDF5 file
description: HDF5 that can be read by k-wave (check [k-Wave documentation](http://www.k-wave.org/documentation/example_cpp_running_simulations.php#heading6))
type: data:*/*
fileToKeyMap:
somefilename.ext: output_1
output.h5: output_1

11 changes: 9 additions & 2 deletions .osparc/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ settings:
type: Resources
value:
Limits:
NanoCPUs: 1000000000 # 100% of CPU cycles on 1 CPU
MemoryBytes: 2147483648 # 2 Gigabytes
NanoCPUs: 8000000000
MemoryBytes: 17179869184
Reservations:
NanoCPUs: 8000000000
MemoryBytes: 17179869184
GenericResources:
- DiscreteResourceSpec:
Kind: VRAM
Value: 1

33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
# k-Wave

Source code of the o²S²PARC Service for k-Wave, A MATLAB toolbox for the time-domain simulation of acoustic wave fields. It uses the kspaceFirst3DG function to run 3D time-domain simulation of wave propagation on a GPU using C++ CUDA code. Find more information about k-Wave [here](http://www.k-wave.org/index.php).
Source code of the k-Wave Service on o²S²PARC. k-Wave is MATLAB/C++ toolbox for the time-domain simulation of acoustic wave fields. This Service uses the C++ function to run 3D time-domain simulation of wave propagation on a GPU using C++ CUDA code. You can find more information about k-Wave [here](http://www.k-wave.org/index.php).

## Usage
The Service runs the kspaceFirstOrder-CUDA function (v1.3)

## Citing the k-Wave Toolbox
If you find the toolbox useful for your academic work, please consider citing one or more of the associated papers, more information [here](http://www.k-wave.org/license.php).

## Information for developers of the o²S²PARC Service
### Usage

```console
$ make help

$ make build
$ make info-build
$ make tests
$ make publish-local
```
**Note**: to build the image, you need an account [to download k-Wave](http://www.k-wave.org/download.php). In version 1.0.0 the pre-compiled executables are used.

## Workflow

1. The source code shall be copied to the [src](k-wave/src/k_wave) folder.
2. The [Dockerfile](k-wave/src/Dockerfile) shall be modified to compile the source code.
3. The [.osparc](.osparc) is the configuration folder and source of truth for metadata: describes service info and expected inputs/outputs of the service.
4. The [execute](k-wave/service.cli/execute) shell script shall be modified to run the service using the expected inputs and retrieve the expected outputs.
5. The test input/output shall be copied to [validation](k-wave/validation).
6. The service docker image may be built and tested as ``make build tests`` (see usage above)
7. Optional: if your code requires specific CPU/RAM resources, edit [runtime.yml](.osparc/runtime.yml). In doubt, leave it as default.
### How to test
Use as input the file `validation/input/input.h5`. Running the service should generate an `output.h5` file.
Is you provide optional boolean flags (either in the UI of in `inputs.json`), you should see additional data fields in the `output.h5` file. To inspect the output file you can use `h5ls -d output.h5`.

## Have an issue or question?
Please open an issue [in this repository](https://github.com/ITISFoundation/cookiecutter-osparc-service/issues/).

Please open an issue [in this repository](https://github.com/ITISFoundation/k-wave/issues/).

---
<p align="center">
<image src="https://github.com/ITISFoundation/osparc-simcore-python-client/blob/4e8b18494f3191d55f6692a6a605818aeeb83f95/docs/_media/mwl.png" alt="Made with love at www.z43.swiss" width="20%" />
</p>

## Citing the k-Wave Toolbox
If you find the toolbox useful for your academic work, please consider citing one or more of the associated papers, more information [here](http://www.k-wave.org/license.php).
60 changes: 31 additions & 29 deletions docker/custom/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:latest as base
FROM nvidia/cudagl:11.2.2-runtime-ubuntu20.04 as base
#
# USAGE:
# cd services/k-wave
Expand Down Expand Up @@ -28,28 +28,39 @@ FROM base as build

ENV SC_BUILD_TARGET build

ARG KWAVE_PASSWORD
ARG KWAVE_LOGIN
# ------------------------------------------------------------------------------------
#TODO:
# uncomment and adapt if build dependencies shall be installed
#RUN apt-get update \
# && apt-get -y install --no-install-recommends \
# gcc \
# git \
# && rm -rf /var/lib/apt/lists/*

# uncomment and adapt if python necessary
#RUN $SC_PIP install --upgrade pip wheel setuptools
# build dependencies shall be installed
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
unzip \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/*

# ------------------------------------------------------------------------------------
# Download binaries (get authentication cookie to login to http://www.k-wave.org/download.php and download the file with the cookie)
# Note, you need to have a valid login and export credentials as env. variables

WORKDIR /build


RUN curl --cookie-jar cookie.txt --form password=$KWAVE_PASSWORD --form user_login=$KWAVE_LOGIN http://www.k-wave.org/forum/bb-login.php && \
curl -L -b cookie.txt http://www.k-wave.org/getfile.php?id=117 -o kwave.zip && \
unzip kwave.zip && \
rm kwave.zip cookie.txt
# ------------------------------------------------------------------------------------


# defines the output of the build
RUN mkdir --parents /build/bin
# copy src code
COPY --chown=${SC_USER_NAME}:${SC_USER_NAME} src/k_wave src/k_wave
# copy src code: There's none for the moment
#COPY --chown=${SC_USER_NAME}:${SC_USER_NAME} src/k_wave src/k_wave
# ------------------------------------------------------------------------------------
#TODO:
# uncomment and adapt if build steps are necessary
# RUN cp -R src/k_wave/* /build/bin
# uncomment and adapt if build steps are necessary. For now, we use the compiled executable
RUN cp -R /build/kspaceFirstOrder-CUDA /build/bin
# ------------------------------------------------------------------------------------

# --------------------------Production stage -------------------
Expand All @@ -74,11 +85,11 @@ ENV INPUT_FOLDER="/input" \
WORKDIR /home/${SC_USER_NAME}

# ------------------------------------------------------------------------------------
#TODO:
# uncomment and adapt to install runtime dependencies
#RUN apt-get update \
# && apt-get -y install --no-install-recommends \
# && rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# ------------------------------------------------------------------------------------

# copy docker bootup scripts
Expand All @@ -90,16 +101,7 @@ ENV PATH="/home/${SC_USER_NAME}/service.cli:${PATH}"

# copy binaries from build
COPY --from=build --chown=${SC_USER_NAME}:${SC_USER_NAME} /build/bin k_wave

# ------------------------------------------------------------------------------------
#TODO:
# uncomment and provide a healtchecker if possible
# HEALTHCHECK --interval=30s \
# --timeout=120s \
# --start-period=30s \
# --retries=3 \
# CMD ["healthchecker app"]
# ------------------------------------------------------------------------------------
RUN chmod +x k_wave/*

ENTRYPOINT [ "/bin/sh", "docker/entrypoint.sh", "/bin/sh", "-c" ]
CMD ["run"]
Loading