Skip to content
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

added call to rocfft_setup() #64

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions include/heffte_backend_rocm.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,23 @@ namespace rocm {
return 4 * (length-1);
}
};

/*!
* \ingroup heffterocm
* \brief Indicates whether the rocfft_setup() method has been called
*/
struct initialize {
//! \brief Static (global) variable indicating if rocfft_setup() has been called
static bool is_initialized;
//! \brief Make initialize
static void make() {
if (not is_initialized) {
rocfft_setup();
is_initialized = true;
}

}
};
}

namespace backend{
Expand Down Expand Up @@ -549,7 +566,9 @@ class rocfft_executor : public executor_base{
total_size(box.count()),
embed({0, 0}),
worksize(compute_workspace_size())
{}
{
rocm::initialize::make();
}
//! \brief Merges two FFTs into one.
template<typename index>
rocfft_executor(hipStream_t active_stream, box3d<index> const box, int dir1, int dir2) :
Expand Down Expand Up @@ -740,7 +759,9 @@ class rocfft_executor_r2c : public executor_base{
rsize(box.count()),
csize(box.r2c(dimension).count()),
worksize(compute_workspace_size())
{}
{
rocm::initialize::make();
}

//! \brief Forward transform, single precision.
template<typename precision_type>
Expand Down
2 changes: 2 additions & 0 deletions src/heffte_backend_rocm.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void synchronize_default_stream(){

namespace rocm {

bool initialize::is_initialized = false;

/*
* Launch with one thread per entry.
*
Expand Down