-
Notifications
You must be signed in to change notification settings - Fork 7
misuka simulation-backend #19
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
Open
tmschnell
wants to merge
11
commits into
choras-org:develop
Choose a base branch
from
tmschnell:misuka
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
48ebfca
Implementation of misuka interface still with debug to find svg NO FI…
tmschnell 90cceb9
removed edc wrong values bug
tmschnell 278e40c
clearing some unused code and adding log option
tmschnell 7f77084
adjust common/exampleInput
tmschnell 3419897
Remove obsolete pressure csv genration code after backend update
tmschnell 6214c27
Update misuka_method/misuka_interface/misuka_interface.py
tmschnell 818ee2f
Update example_settings/misuka_setting.json
tmschnell b1ff936
Update example_settings/misuka_setting.json
tmschnell 9e84b82
Update example_settings/misuka_setting.json
tmschnell 41c8a06
Changes following the pull request feedback
tmschnell 96ebb18
CHANGES: fetching misuka from discussed tag, added description for in…
tmschnell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| { | ||
| "geo_path": "test_room_misuka.geo", | ||
| "msh_path": "test_room_misuka.msh", | ||
| "absorption_coefficients": { | ||
| "floor": "0.05, 0.05, 0.08, 0.1, 0.12, 0.15", | ||
| "wall1": "0.05, 0.05, 0.08, 0.1, 0.12, 0.15", | ||
| "ceiling": "0.4, 0.5, 0.6, 0.7, 0.8, 0.9", | ||
| "wall2": "0.05, 0.05, 0.08, 0.1, 0.12, 0.15", | ||
| "wall3": "0.05, 0.05, 0.08, 0.1, 0.12, 0.15", | ||
| "wall4": "0.05, 0.05, 0.08, 0.1, 0.12, 0.15" | ||
| }, | ||
| "simulationSettings": { | ||
| "rays_per_frequency": 1048576, | ||
| "max_time": 0.1, | ||
| "sampling_rate": 10000, | ||
| "sound_power_W": 1, | ||
| "speed_of_sound": 343, | ||
| "dynamic_range_db": "no", | ||
| "scattering_125": 0.1, | ||
| "scattering_250": 0.1, | ||
| "scattering_500": 0.1, | ||
| "scattering_1000": 0.1, | ||
| "scattering_2000": 0.1, | ||
| "scattering_4000": 0.1, | ||
| "log_data": "no" | ||
| }, | ||
| "results": [ | ||
| { | ||
| "simulationMethodId": 1, | ||
| "resultType": "IR", | ||
| "simulationId": 1, | ||
| "sourceX": 1.0, | ||
| "sourceY": 2.0, | ||
| "sourceZ": 1.5, | ||
| "frequencies": [ | ||
| 125, | ||
| 250, | ||
| 500, | ||
| 1000, | ||
| 2000, | ||
| 4000 | ||
| ], | ||
| "percentage": 0, | ||
| "responses": [ | ||
| { | ||
| "responseId": 1, | ||
| "x": 5.0, | ||
| "y": 3.5, | ||
| "z": 1.5, | ||
| "parameters": { | ||
| "edt": [], | ||
| "t20": [], | ||
| "t30": [], | ||
| "c80": [], | ||
| "d50": [], | ||
| "ts": [], | ||
| "spl_t0_freq": [] | ||
| }, | ||
| "receiverResults": [] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| { | ||
| "type": "simulationSettings", | ||
| "options": [ | ||
| { | ||
| "name": "Rays per Frequency Band", | ||
| "id": "rays_per_frequency", | ||
| "type": "integer", | ||
| "display": "text", | ||
| "min": 1000, | ||
| "max": 4194304, | ||
| "step": 524288, | ||
| "default": 1048576, | ||
| "description": "Number of rays used for every frequency band in every source-reciever simulation." | ||
| }, | ||
| { | ||
| "name": "Maximum Response Length", | ||
| "id": "max_time", | ||
| "type": "float", | ||
| "display": "text", | ||
| "min": 0.01, | ||
| "max": 20, | ||
| "step": 1.0, | ||
| "default": 10, | ||
| "endAdornment": "s", | ||
| "description": "Length of the simulated IR." | ||
| }, | ||
| { | ||
| "name": "Histogram sampling rate", | ||
| "id": "sampling_rate", | ||
| "type": "integer", | ||
| "display": "text", | ||
| "min": 100, | ||
| "max": 40000, | ||
| "step": 1000, | ||
| "default": 20000, | ||
| "endAdornment": "Hz", | ||
| "description": "Sampling rate of the simulated histogram." | ||
| }, | ||
| { | ||
| "name": "Speed of Sound", | ||
| "id": "speed_of_sound", | ||
| "display": "text", | ||
| "type": "float", | ||
| "min": 200, | ||
| "max": 360, | ||
| "step": 5, | ||
| "default": 343, | ||
| "endAdornment": "m/s", | ||
| "description": "Speed of sound in m/s that is used in simulation." | ||
| }, | ||
| { | ||
| "name": "Limit Dynamic Range", | ||
| "id": "dynamic_range_db", | ||
| "type": "integer", | ||
| "display": "text", | ||
| "min": -1, | ||
| "max": 250, | ||
| "step": 20, | ||
| "default": -1, | ||
| "endAdornment": "dB", | ||
| "description": "Using a positive integer input will limit the dynamic range (EDC_max - EDC_min) to that input." | ||
| }, | ||
| { | ||
| "name": "Scattering", | ||
| "id": "scattering_coefficients", | ||
| "display": "text", | ||
| "type": "string", | ||
| "default": "0.1, 0.1, 0.1, 0.1, 0.1", | ||
| "endAdornment": "", | ||
| "description": "Used for controlling scattering on all surface materials for the different frequency bands [s(125), s(250), s(500), s(1000), s(2000)]." | ||
| } | ||
| ], | ||
|
|
||
| "_future_options": [ | ||
| { | ||
| "name": "Maximum Energy Loss", | ||
| "id": "max_energy_loss", | ||
| "type": "integer", | ||
| "display": "text", | ||
| "min": 0, | ||
| "max": 100, | ||
| "step": 1, | ||
| "default": 50, | ||
| "endAdornment": "%" | ||
| }, | ||
| { | ||
| "name": "Processing Unit", | ||
| "id": "comp_backend", | ||
| "type": "string", | ||
| "display": "radio", | ||
| "options": | ||
| { | ||
| "CPU": "cpu", | ||
| "CUDA GPU": "gpu" | ||
| }, | ||
| "default": "cpu" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| # ---------- Stage 1: builder ---------- | ||
| FROM ubuntu:22.04 AS builder | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| software-properties-common \ | ||
| wget \ | ||
| gnupg \ | ||
| lsb-release \ | ||
| ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Add LLVM repo for Clang 17 | ||
| RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \ | ||
| echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" \ | ||
| > /etc/apt/sources.list.d/llvm.list | ||
|
|
||
| RUN add-apt-repository ppa:deadsnakes/ppa && \ | ||
| apt-get update && apt-get install -y \ | ||
| python3.11 \ | ||
| python3.11-dev \ | ||
| python3.11-distutils \ | ||
| python3-pip \ | ||
| clang-17 \ | ||
| libc++-17-dev \ | ||
| libc++abi-17-dev \ | ||
| libllvm17 \ | ||
| cmake \ | ||
| ninja-build \ | ||
| ccache \ | ||
| git \ | ||
| build-essential \ | ||
| zlib1g-dev \ | ||
| libpng-dev \ | ||
| libjpeg-dev \ | ||
| gmsh \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| ENV CC=clang-17 | ||
| ENV CXX=clang++-17 | ||
| ENV CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
| ENV CMAKE_C_COMPILER_LAUNCHER=ccache | ||
|
|
||
| RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 | ||
| RUN python3.11 -m pip install --upgrade pip typing_extensions | ||
|
|
||
| # Shallow clone of misuka from the lgpl branch | ||
| RUN mkdir -p /opt/misuka && cd /opt/misuka && \ | ||
| git init && \ | ||
| git remote add origin https://github.com/misuka-renderer/misuka.git && \ | ||
| git fetch --depth 1 origin lgpl && \ | ||
| git checkout FETCH_HEAD && \ | ||
| git submodule update --init --recursive --depth 1 | ||
|
|
||
| # Build misuka from source, with ccache to speed up rebuilds | ||
| RUN --mount=type=cache,target=/root/.ccache \ | ||
| cd /opt/misuka && \ | ||
| mkdir build && cd build && \ | ||
| cmake -GNinja .. \ | ||
| -DMI_DEFAULT_VARIANTS="scalar_rgb;llvm_ad_rgb;llvm_ad_acoustic" \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DPython_EXECUTABLE=/usr/bin/python3.11 \ | ||
| -DPython3_EXECUTABLE=/usr/bin/python3.11 && \ | ||
| ninja && \ | ||
| ccache -s | ||
|
|
||
| WORKDIR /app | ||
| COPY misuka_method /app/misuka_method | ||
| RUN python3.11 -m pip install --target=/opt/misuka_python \ | ||
| numpy \ | ||
| requests \ | ||
| meshio \ | ||
| pyfar \ | ||
| pyrato \ | ||
| pandas && \ | ||
| python3.11 -m pip install --no-deps --target=/opt/misuka_python /app/misuka_method | ||
|
|
||
| # ---------- Stage 2: runtime ---------- | ||
| FROM ubuntu:22.04 AS runtime | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| software-properties-common ca-certificates gnupg wget lsb-release && \ | ||
| add-apt-repository ppa:deadsnakes/ppa && \ | ||
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \ | ||
| echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" > /etc/apt/sources.list.d/llvm.list && \ | ||
| apt-get update && apt-get install -y \ | ||
| python3.11 \ | ||
| python3-pip \ | ||
| libc++1-17 \ | ||
| libc++abi1-17 \ | ||
| libllvm17 \ | ||
| libpng16-16 \ | ||
| libjpeg-turbo8 \ | ||
| libglu1-mesa \ | ||
| gmsh \ | ||
| python3-gmsh \ | ||
| zlib1g \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 | ||
|
|
||
| # Misuka's compiled build output (libmitsuba.so, libdrjit-extra.so, plugins/, etc.) | ||
| COPY --from=builder /opt/misuka/build /opt/misuka/build | ||
|
|
||
| # Python package and dependencies installed in the builder stage. | ||
| COPY --from=builder /opt/misuka_python /opt/misuka_python | ||
|
|
||
| ENV LD_LIBRARY_PATH="/opt/misuka/build" | ||
| ENV PYTHONPATH="/opt/misuka_python:/opt/misuka/build/python:/usr/lib/python3/dist-packages" | ||
| ENV DRJIT_LIBLLVM_PATH="/usr/lib/x86_64-linux-gnu/libLLVM-17.so" | ||
|
|
||
| WORKDIR /app/misuka_method | ||
| CMD ["python3.11", "-m", "misuka_interface"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| ---------------------------------------------------------------------- | ||
| Combined Licensing Note | ||
| ---------------------------------------------------------------------- | ||
|
|
||
| This repository is based on code from **Mitsuba 3**, originally developed by | ||
| Wenzel Jakob and licensed under the terms listed at the bottom of this page. | ||
|
|
||
| All modifications and additions made for **misuka** by the misuka contributors | ||
| are licensed under the GNU Lesser General Public License (LGPL), version 3 | ||
| or (at your option) any later version. | ||
|
|
||
| When using, modifying, or redistributing this software, you must comply with | ||
| both licenses as they apply to the respective portions of the code. | ||
|
|
||
| ---------------------------------------------------------------------- | ||
| File Level Licensing Rules | ||
| ---------------------------------------------------------------------- | ||
|
|
||
| 1. New files created for misuka | ||
| All files authored specifically for misuka and not derived from Mitsuba | ||
| code are licensed under the GNU Lesser General Public License (LGPL), | ||
| version 3 or any later version. | ||
|
|
||
| 2. Files originating from Mitsuba 3 | ||
| Files that come from the Mitsuba 3 codebase remain under the original | ||
| Mitsuba 3 license. | ||
|
|
||
| 3. Modified Mitsuba files | ||
| For files derived from Mitsuba code that contain modifications by misuka | ||
| contributors: | ||
| - The original Mitsuba portions remain under the original Mitsuba license. | ||
| - Any modifications licensed under the LGPL must be clearly marked in the | ||
| file header. | ||
| - If no such note is present, the entire file remains under the original | ||
| Mitsuba license. | ||
|
|
||
|
|
||
| ---------------------------------------------------------------------- | ||
| Code for misuka (LGPL) | ||
| ---------------------------------------------------------------------- | ||
|
|
||
| Copyright (c) 2025 The misuka contributors | ||
|
|
||
| All modifications and additions to this software made for Misuka are licensed | ||
| under the terms of the GNU Lesser General Public License (LGPL), version 3 or | ||
| (at your option) any later version. | ||
|
|
||
| You may obtain a copy of the LGPL at: | ||
| https://www.gnu.org/licenses/lgpl-3.0.html | ||
|
|
||
| This means: | ||
| - You may use and redistribute this code under the terms of the LGPL. | ||
| - You must make source code available for any changes to LGPL-covered parts. | ||
| - You may link this library with proprietary software under the conditions | ||
| specified in the LGPL. | ||
|
|
||
|
|
||
| ---------------------------------------------------------------------- | ||
| Original Code from Mitsuba 3 | ||
| ---------------------------------------------------------------------- | ||
|
|
||
| Copyright (c) 2017 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are met: | ||
|
|
||
| 1. Redistributions of source code must retain the above copyright notice, this | ||
| list of conditions and the following disclaimer. | ||
|
|
||
| 2. Redistributions in binary form must reproduce the above copyright notice, | ||
| this list of conditions and the following disclaimer in the documentation | ||
| and/or other materials provided with the distribution. | ||
|
|
||
| 3. Neither the name of the copyright holder nor the names of its contributors | ||
| may be used to endorse or promote products derived from this software | ||
| without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
| FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
| You are under no obligation whatsoever to provide any bug fixes, patches, or | ||
| upgrades to the features, functionality or performance of the source code | ||
| ("Enhancements") to anyone; however, if you choose to make your Enhancements | ||
| available either publicly, or directly to the author of this software, without | ||
| imposing a separate written license agreement for such Enhancements, then you | ||
| hereby grant the following license: a non-exclusive, royalty-free perpetual | ||
| license to install, use, modify, prepare derivative works, incorporate into | ||
| other computer software, distribute, and sublicense such enhancements or | ||
| derivative works thereof, in binary and source code form. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not commenting on this file until finalized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The multi-stage builds now pull one of the most recent Misuka commits, as Misuka recently received a major update. By switching to multi-stage builds, the image size was reduced from 6 GB to 2.47 GB.
One of the main factors influencing the final image size is the number of Misuka variants that are included. At the moment, three variants are being built because I have not yet found a way to build Misuka with fewer than these three. I will get in touch with @tjueterb to confirm whether this selection is already optimal or if it can be reduced further.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure the licenses of misuka and CHORAS are compatible before using the newest update. Let's talk tomorrow :)