-
Notifications
You must be signed in to change notification settings - Fork 922
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 #3135 from trevorsm7/fea-move-nvtx-functions-to-na…
…mespace [REVIEW] Add nvtx functions to cudf namespace
- Loading branch information
Showing
11 changed files
with
143 additions
and
20 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
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
namespace cudf { | ||
namespace nvtx { | ||
|
||
enum class color : uint32_t { | ||
GREEN = 0xff00ff00, | ||
BLUE = 0xff0000ff, | ||
YELLOW = 0xffffff00, | ||
PURPLE = 0xffff00ff, | ||
CYAN = 0xff00ffff, | ||
RED = 0xffff0000, | ||
WHITE = 0xffffffff, | ||
DARK_GREEN = 0xff006600, | ||
ORANGE = 0xffffa500, | ||
}; | ||
|
||
constexpr color JOIN_COLOR = color::CYAN; | ||
constexpr color GROUPBY_COLOR = color::GREEN; | ||
constexpr color BINARY_OP_COLOR = color::YELLOW; | ||
constexpr color PARTITION_COLOR = color::PURPLE; | ||
constexpr color READ_CSV_COLOR = color::PURPLE; | ||
|
||
/**---------------------------------------------------------------------------* | ||
* @brief Start an NVTX range. | ||
* | ||
* This function is useful only for profiling with nvvp or Nsight Systems. It | ||
* demarcates the begining of a user-defined range with a specified name and | ||
* color that will show up in the timeline view of nvvp/Nsight Systems. Can be | ||
* nested within other ranges. | ||
* | ||
* @throws cudf::logic_error if `name` is null | ||
* | ||
* @param[in] name The name of the NVTX range | ||
* @param[in] color The color to use for the range | ||
*---------------------------------------------------------------------------**/ | ||
void range_push(const char* name, color color); | ||
|
||
/**---------------------------------------------------------------------------* | ||
* @brief Start a NVTX range with a custom ARGB color code. | ||
* | ||
* This function is useful only for profiling with nvvp or Nsight Systems. It | ||
* demarcates the begining of a user-defined range with a specified name and | ||
* color that will show up in the timeline view of nvvp/Nsight Systems. Can be | ||
* nested within other ranges. | ||
* | ||
* @throws cudf::logic_error if `name` is null | ||
* | ||
* @param[in] name The name of the NVTX range | ||
* @param[in] color The ARGB hex color code to use to color this range (e.g., 0xFF00FF00) | ||
*---------------------------------------------------------------------------**/ | ||
void range_push_hex(const char* name, uint32_t color); | ||
|
||
/**---------------------------------------------------------------------------* | ||
* @brief Ends the inner-most NVTX range. | ||
* | ||
* This function is useful only for profiling with nvvp or Nsight Systems. It | ||
* will demarcate the end of the inner-most range, i.e., the most recent call to | ||
* range_push. | ||
*---------------------------------------------------------------------------**/ | ||
void range_pop(); | ||
|
||
} // namespace nvtx | ||
} // namespace cudf |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (c) 2019, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include <cudf/utilities/nvtx_utils.hpp> | ||
#include "utilities/error_utils.hpp" | ||
|
||
#ifdef USE_NVTX | ||
#include <nvToolsExt.h> | ||
#endif | ||
|
||
namespace cudf { | ||
namespace nvtx { | ||
|
||
void range_push(const char* name, color color) | ||
{ | ||
range_push_hex(name, static_cast<uint32_t>(color)); | ||
} | ||
|
||
void range_push_hex(const char* name, uint32_t color) | ||
{ | ||
#ifdef USE_NVTX | ||
CUDF_EXPECTS(name != nullptr, "Null name string."); | ||
|
||
nvtxEventAttributes_t eventAttrib{}; | ||
eventAttrib.version = NVTX_VERSION; | ||
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; | ||
eventAttrib.colorType = NVTX_COLOR_ARGB; | ||
eventAttrib.color = color; | ||
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; | ||
eventAttrib.message.ascii = name; | ||
nvtxRangePushEx(&eventAttrib); | ||
#endif | ||
} | ||
|
||
void range_pop() | ||
{ | ||
#ifdef USE_NVTX | ||
nvtxRangePop(); | ||
#endif | ||
} | ||
|
||
} // namespace nvtx | ||
} // namespace cudf |
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