context.hpp
1 /*
2  * Copyright (c) 2025, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cudf/utilities/export.hpp>
20 
21 #include <cstdint>
22 #include <type_traits>
23 
24 namespace CUDF_EXPORT cudf {
25 
27 enum class init_flags : std::uint32_t {
29  LOAD_NVCOMP = 1 << 0,
31  INIT_JIT_CACHE = 1 << 1,
34 };
35 
40 constexpr init_flags operator|(init_flags lhs, init_flags rhs) noexcept
41 {
42  using underlying_t = std::underlying_type_t<init_flags>;
43  return static_cast<init_flags>(static_cast<underlying_t>(lhs) | static_cast<underlying_t>(rhs));
44 }
45 
50 constexpr bool has_flag(init_flags flags, init_flags flag) noexcept
51 {
52  return (flags | flag) == flags;
53 }
54 
58 void initialize(init_flags flags = init_flags::INIT_JIT_CACHE);
59 
62 void deinitialize();
63 
64 } // namespace CUDF_EXPORT cudf
constexpr string_character_types operator|(string_character_types lhs, string_character_types rhs)
OR operator for combining string_character_types.
cuDF interfaces
Definition: host_udf.hpp:37
constexpr bool has_flag(init_flags flags, init_flags flag) noexcept
Check if a flag is set.
Definition: context.hpp:50
void deinitialize()
de-initialize the cudf global context
void initialize(init_flags flags=init_flags::INIT_JIT_CACHE)
Initialize the cudf global context.
init_flags
Flags for controlling initialization steps.
Definition: context.hpp:27
@ ALL
All initialization steps (default behavior)
@ INIT_JIT_CACHE
Initialize the JIT program cache during initialization.
@ LOAD_NVCOMP
Load the nvCOMP library during initialization.