Repository navigation
GPU CMake: enable the Metal backend by default where the toolchain supports it #15982
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
base: dev
Are you sure you want to change the base?
Changes from all commits
43104e7
c08e329
34e1c54
720ab81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,18 +81,42 @@ The standalone benchmark supports running on Run2 data exported from AliRoot, or | |
| In o2, `o2-tpc-reco-workflow` and the `o2-gpu-reco-workflow` can dump event data with the `configKeyValue` `GPU_global.dump=1;`. | ||
| This will dump the event data to the local folder, all dumped files have a `.dump` file extension. If there are multiple TFs/events processed, there will be multiple `event.i.dump` files. In order to create a standalone dataset out of these, just copy all the `.dump` files to a subfolder in `~/standalone/events/[FOLDERNAME]`. | ||
|
|
||
| ## What a dataset consists of | ||
|
|
||
| A dataset folder is read by `GPUReconstruction::ReadSettings` and `GPUChainTracking::ReadSettings`, and holds: | ||
|
|
||
| - `settings.dump` - the GRP settings (solenoid field, continuous max time bin). Without it the benchmark aborts with `Error reading event config file`. | ||
| - `event.<i>.dump` - one file per time frame / event. | ||
| - the calibration objects, each written only if it was present when dumping: `tpctransform.dump`, `tpcpadgaincalib.dump`, `tpczslinkmapping.dump`, `dEdxCalibContainer.dump`, `matlut.dump`, `trdgeometry.dump`, `trdrecoparam.dump`. | ||
|
|
||
| `tpctransform.dump` is needed for everything except already-transformed clusters; without it the run stops at `Need cluster native data for on-the-fly TPC transform`. `dEdxCalibContainer.dump` is needed unless dE/dx is switched off with `--rundEdx 0`. | ||
|
|
||
| The folder is looked up under `./events/` relative to the working directory, so `-e mydata` reads `./events/mydata/`. Use `--absoluteEventsDir` to pass a path outside of `./events/`. | ||
|
|
||
| ## From simulated data | ||
|
|
||
| Data can be dumped from raw data, or from MC data, e.g. generated by the Full System Test. In case of MC data, also MC labels are dumped, such that they are used in the `./ca --qa` mode. | ||
|
|
||
| To get a dump from simulated data, please run e.g. the FST simulation as described in [full-system-test-setup.md](https://github.com/AliceO2Group/AliceO2/blob/dev/prodtests/full-system-test/documentation/full-system-test-setup.md). | ||
| A simple run as | ||
| First simulate, digitize and convert to raw, as described in [full-system-test-setup.md](https://github.com/AliceO2Group/AliceO2/blob/dev/prodtests/full-system-test/documentation/full-system-test-setup.md). Run it in a scratch folder, since it writes a lot of intermediate files: | ||
| ``` | ||
| DISABLE_PROCESSING=1 NEvents=5 NEventsQED=100 SHMSIZE=16000000000 $O2_ROOT/prodtests/full_system_test.sh | ||
| mkdir -p test && cd test | ||
| ulimit -n 1024 | ||
| NEvents=5 NEventsQED=100 $O2_ROOT/prodtests/full_system_test.sh | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove DISALBE_PROCESSING? It is not needed for dumping files. And why did you remove SHMSIZE? (althoigh not 100% sure it is needed without DISABLE_PROCESSING). |
||
| ``` | ||
| should be enough. | ||
| `ulimit -n 1024` avoids the workflow running out of file descriptors. `NEventsQED` controls the QED background, which dominates the TPC occupancy, so lower it for a smaller dataset. | ||
|
|
||
| Afterwards run the following command to dump the data: | ||
| This leaves the raw time frames in `raw/` and already runs the reconstruction once. To get the dumps, re-run only the reconstruction over that raw data with the dump enabled: | ||
| ``` | ||
| SYNCMODE=1 CONFIG_EXTRA_PROCESS_o2_gpu_reco_workflow="GPU_global.dump=1;" WORKFLOW_DETECTORS=TPC SHMSIZE=16000000000 $O2_ROOT/prodtests/full-system-test/dpl-workflow.sh | ||
| ARGS_ALL_EXTRA="--completion-policy=wait --exit-transition-timeout 20" \ | ||
| CONFIG_EXTRA_PROCESS_o2_gpu_reco_workflow="GPU_global.dump=1;" \ | ||
| WORKFLOW_DETECTORS=TPC SYNCMODE=1 SHMSIZE=$((16<<30)) EXTINPUT=1 \ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you propose to use EXTINPUT? It should be easiest for the user to ust convert the existing raw data, and not run DD or some other chain in parallel to go over the readout proxy. And why do we need the completion policy and exit transition settings here? I'd leave this as is, and you can add an additional comment below how to get the data from DataDistribution, but I'd not make the base version more complicated than necessary. |
||
| $O2_ROOT/prodtests/full-system-test/dpl-workflow.sh | ||
| ``` | ||
| `CONFIG_EXTRA_PROCESS_o2_gpu_reco_workflow="GPU_global.dump=1;"` is what writes the `.dump` files; everything else just shapes the workflow. `--completion-policy=wait` and `--exit-transition-timeout 20` let the workflow drain and shut down by itself once the input ends, instead of having to be killed. `EXTINPUT=1` takes the raw data from the `readout-proxy` FMQ channel, which means a feeder has to run in a second shell (`datadistribution.sh` from the same folder, which needs the `DataDistribution` package). Leave `EXTINPUT` unset to have `dpl-workflow.sh` read the raw files directly instead, which needs no second process. See [env-variables.md](https://github.com/AliceO2Group/AliceO2/blob/dev/prodtests/full-system-test/documentation/env-variables.md) for the other variables. | ||
|
|
||
| Finally collect the result into a dataset: | ||
| ``` | ||
| mkdir -p ~/standalone/events/fst-tpc && cp *.dump ~/standalone/events/fst-tpc/ | ||
| ``` | ||
|
|
||
| To dump standalone data from CTF raw data in `myctf.root`, you can use the same script, e.g.: | ||
|
|
@@ -101,3 +125,16 @@ CTFINPUT=1 INPUT_FILE_LIST=myctf.root CONFIG_EXTRA_PROCESS_o2_gpu_reco_workflow= | |
| ``` | ||
|
|
||
| On the EPNs, you can find some reference data sets at `/home/drohr/standalone/events`. | ||
|
|
||
| ## Using the built-in event generator | ||
|
|
||
| With `--eventGenerator` the benchmark generates simple synthetic events itself, without any simulation or raw data. The parent `events/` folder has to exist, since the generator only creates the dataset folder itself: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, it might be worth mentioning it, but this built-in generator was done for some particular studies how the track fit behaves and it is fully unsupported. So I would in principle discourage using it for anything but special tests.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, I will simply drop the changes to the documentation form this commit and review them separately. |
||
| ``` | ||
| mkdir -p events | ||
| ./ca --eventGenerator -e gen --setMaxTimeBin 0 --rundEdx 0 | ||
| ``` | ||
| `--setMaxTimeBin` has to be given, because the GRP settings are not read from a dataset in this mode and their default is the invalid sentinel `-2`. | ||
|
|
||
| This writes `settings.dump` and the `event.<i>.dump` files, but no calibration objects. The events hold the legacy cluster format, not native clusters, so they can be inspected and used for the generator's own QA, but tracking on them stops at `Need cluster native data for on-the-fly TPC transform`, also with calibration objects present. | ||
|
|
||
| `--recreateTrivialCalibObjects` writes default calibration objects (`tpctransform.dump`, `dEdxCalibContainer.dump`, ...) to the current folder without CCDB access; it needs `O2_ROOT` set for the TPC mapping files. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| # or submit itself to any jurisdiction. | ||
|
|
||
| # NOTE!!!! - Whenever this file is changed, move it over to alidist/resources | ||
| # FindO2GPU.cmake Version 23 | ||
| # FindO2GPU.cmake Version 25 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does it jump by 2 version numbers?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I merged two commits. I will fix it. |
||
|
|
||
| set(CUDA_COMPUTETARGET_DEFAULT_FULL 80-real;86-real;89-real;120-real;75-virtual) | ||
| set(HIP_AMDGPUTARGET_DEFAULT_FULL gfx906;gfx908) | ||
|
|
@@ -21,8 +21,7 @@ if(NOT DEFINED ENABLE_CUDA) | |
| set(ENABLE_CUDA "AUTO") | ||
| endif() | ||
| if(NOT DEFINED ENABLE_METAL) | ||
| # OFF rather than AUTO while the backend is unproven | ||
| set(ENABLE_METAL "OFF") | ||
| set(ENABLE_METAL "AUTO") | ||
| endif() | ||
| if(NOT DEFINED ENABLE_OPENCL) | ||
| set(ENABLE_OPENCL "AUTO") | ||
|
|
@@ -467,15 +466,14 @@ if(ENABLE_METAL) | |
| # The frameworks are there on every macOS, but the backend needs MSL 4.1, which | ||
| # is macOS 27 and its toolchain, so ask the compiler instead of assuming. A | ||
| # library built as MSL 4.1 also only loads on macOS 27 and later. | ||
| if(NOT DEFINED GPUCA_METAL_MSL41) | ||
| # Only a success is cached, so that installing the toolchain is picked up. | ||
| if(NOT GPUCA_METAL_MSL41) | ||
| set(GPUCA_METAL_PROBE "${CMAKE_CURRENT_BINARY_DIR}/metal_msl41_probe.metal") | ||
| file(WRITE "${GPUCA_METAL_PROBE}" "#include <metal_stdlib>\nkernel void probe(device float* o [[buffer(0)]], uint i [[thread_position_in_grid]]) { o[i] = o[i] * 2.0f; }\n") | ||
| execute_process(COMMAND xcrun -sdk macosx metal -std=metal4.1 -c "${GPUCA_METAL_PROBE}" -o "${GPUCA_METAL_PROBE}.air" | ||
| RESULT_VARIABLE GPUCA_METAL_PROBE_RESULT OUTPUT_QUIET ERROR_QUIET) | ||
| RESULT_VARIABLE GPUCA_METAL_PROBE_RESULT OUTPUT_QUIET ERROR_VARIABLE GPUCA_METAL_PROBE_ERROR) | ||
| if(GPUCA_METAL_PROBE_RESULT EQUAL 0) | ||
| set(GPUCA_METAL_MSL41 ON CACHE INTERNAL "Metal toolchain compiles MSL 4.1") | ||
| else() | ||
| set(GPUCA_METAL_MSL41 OFF CACHE INTERNAL "Metal toolchain compiles MSL 4.1") | ||
| endif() | ||
| endif() | ||
| if(METAL_FRAMEWORK AND COREFOUNDATION_FRAMEWORK AND FOUNDATION_FRAMEWORK AND QUARTZCORE_FRAMEWORK AND GPUCA_METAL_MSL41) | ||
|
|
@@ -487,8 +485,9 @@ if(ENABLE_METAL) | |
| if(NOT METAL_FRAMEWORK OR NOT COREFOUNDATION_FRAMEWORK OR NOT FOUNDATION_FRAMEWORK OR NOT QUARTZCORE_FRAMEWORK) | ||
| message(FATAL_ERROR "Metal frameworks not available") | ||
| endif() | ||
| message(FATAL_ERROR "The Metal backend needs MSL 4.1: this toolchain rejects -std=metal4.1, and the result would need macOS 27 to run") | ||
| message(FATAL_ERROR "The Metal backend needs MSL 4.1: this toolchain rejects -std=metal4.1, and the result would need macOS 27 to run\n${GPUCA_METAL_PROBE_ERROR}") | ||
| else() | ||
| message(STATUS "Metal backend disabled, the toolchain does not compile MSL 4.1: ${GPUCA_METAL_PROBE_ERROR}") | ||
| set(METAL_ENABLED OFF) | ||
| endif() | ||
| endif() | ||
|
|
||
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.
While at it, it might be worth mentioning an explaining the recreateTrivialCalibObjects option. When some of the calibration data formats in O2 changes, which happens often, the event.*.dump is still readable, but the other files need updating. It can be done either by dumping again from dpl-workflow.sh. But for MC without distortions, i.e. when all files just use nominal values, the standalone benchmark has
recreateTrivialCalibObjectsto recreate the files. There are 2 different verions, o2-gpu-standalone-benchmark of O2 can rebuold all of them, and the ca binary of the standalone benchmark most of them (it lacks access to CCDB).