-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #877 from valassi/color2
Further fixes/improvements for iconfig-channel mappings in coloramps.h
- Loading branch information
Showing
249 changed files
with
13,306 additions
and
8,924 deletions.
There are no files selected for viewing
This file contains 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 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
46 changes: 25 additions & 21 deletions
46
...X/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/madgraph/iolibs/template_files/gpu/coloramps.h
This file contains 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 |
---|---|---|
@@ -1,41 +1,45 @@ | ||
// Copyright (C) 2020-2024 CERN and UCLouvain. | ||
// Licensed under the GNU Lesser General Public License (version 3 or later). | ||
// Created by: A. Valassi (Dec 2022) for the MG5aMC CUDACPP plugin. | ||
// Further modified by: A. Valassi (2022-2024) for the MG5aMC CUDACPP plugin. | ||
// Further modified by: O. Mattelaer, A. Valassi (2022-2024) for the MG5aMC CUDACPP plugin. | ||
|
||
#ifndef COLORAMPS_H | ||
#define COLORAMPS_H 1 | ||
|
||
#include <map> | ||
// Note: strictly speaking the check '#ifdef MGONGPU_SUPPORTS_MULTICHANNEL' is not needed here, | ||
// because coloramps.h is not included otherwise, but adding it does not harm and makes the code clearer | ||
|
||
#ifdef MGONGPU_SUPPORTS_MULTICHANNEL /* clang-format off */ | ||
|
||
namespace mgOnGpu | ||
{ | ||
// Summary of numbering and indexing conventions for the relevant concepts (see issue #826 and PR #852) | ||
// - Diagram number (no variable) in [1, N_diagrams]: all values are allowed (N_diagrams distinct values) | ||
// => this number is displayed for information before each block of code in CPPProcess.cc | ||
// - Channel number (CHANNEL_ID) in [0, N_diagrams]: not all values are allowed (N_config <= N_diagrams distinct values) | ||
// => this number (with indexing like ps/pdf output) is passed around as an API argument between cudacpp functions | ||
// 0 is allowed to fallback to no multi-channel mode. | ||
// - Channel number in C indexing: "IconfiC", this is the equivalent of the Fortran iconfig | ||
// iconfigC = iconfig -1 | ||
// provides a continuous index [0, N_config-1] for array | ||
// iconfigC = ChannelId_to_iconfigC[channelId] | ||
//NOTE: All those ordering are event by event specific (with the intent to have those fix within a vector size/wrap | ||
|
||
// Map channelId to iconfigC | ||
// This array has N_diagrams+1 elements, but only N_config <= N_diagrams valid values | ||
// unvalid values are set to -1 | ||
// The 0 entry is a fall back to still write events even if no multi-channel is setup (wrong color selected in that mode) | ||
__device__ constexpr int channelId_to_iconfigC[%(nb_diag_plus_one)i] = { | ||
0, // channelId=0: This value means not multi-channel, color will be wrong anyway -> pick the first | ||
%(diag_to_channel)s | ||
// - Channel number ("channelId" in C, CHANNEL_ID in F) in [1, N_diagrams]: not all values are allowed (N_config <= N_diagrams distinct values) | ||
// => this number (with F indexing as in ps/pdf output) is passed around as an API argument between cudacpp functions | ||
// Note: the old API passes around a single CHANNEL_ID (and uses CHANNEL_ID=0 to indicate no-multichannel mode, but this is not used in coloramps.h), | ||
// while the new API passes around an array of CHANNEL_ID's (and uses a NULL array pointer to indicate no-multichannel mode) | ||
// - Channel number in C indexing: "channelID - 1" | ||
// => this number (with C indexing) is used as the index of the channel2iconfig array below | ||
// - Config number ("iconfig" in C, ICONFIG in F) in [1, N_config]: all values are allowed (N_config <= N_diagrams distinct values) | ||
// - Config number in C indexing: "iconfig - 1" | ||
// => this number (with C indexing) is used as the index of the icolamp array below | ||
|
||
// Map channel to iconfig (e.g. "iconfig = channel2iconfig[channelId - 1]": input index uses C indexing, output index uses F indexing) | ||
// Note: iconfig=-1 indicates channels/diagrams with no associated iconfig for single-diagram enhancement in the MadEvent sampling algorithm (presence of 4-point interaction?) | ||
// This array has N_diagrams elements, but only N_config <= N_diagrams valid values (iconfig>0) | ||
__device__ constexpr int channel2iconfig[%(nb_diag)i] = { // note: a trailing comma in the initializer list is allowed | ||
%(channelc2iconfig_lines)s | ||
}; | ||
|
||
// Map iconfigC (in C indexing, i.e. iconfig-1) to the set of allowed colors | ||
// This array has N_config <= N_diagrams elements | ||
__device__ constexpr bool icolamp[%(nb_channel)s][%(nb_color)s] = { | ||
// Map iconfig to the mask of allowed colors (e.g. "colormask = icolamp[iconfig - 1]": input index uses C indexing) | ||
// This array has N_config <= N_diagrams elements | ||
__device__ constexpr bool icolamp[%(nb_channel)s][%(nb_color)s] = { // note: a trailing comma in the initializer list is allowed | ||
%(is_LC)s | ||
}; | ||
|
||
} | ||
#endif /* clang-format on */ | ||
|
||
#endif // COLORAMPS_H |
This file contains 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 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 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 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
Oops, something went wrong.