Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86467979
cufft_engine.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Oct 6, 16:21
Size
2 KB
Mime Type
text/x-c
Expires
Tue, Oct 8, 16:21 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21417276
Attached To
rTAMAAS tamaas
cufft_engine.cpp
View Options
/**
* @file
* LICENSE
*
* Copyright (©) 2016-2021 EPFL (École Polytechnique Fédérale de Lausanne),
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "cufft_engine.hh"
#include <algorithm>
#include <functional>
#include <numeric>
/* -------------------------------------------------------------------------- */
namespace
tamaas
{
CuFFTEngine
::
plan_t
&
CuFFTEngine
::
getPlans
(
key_t
key
)
{
if
(
plans
.
find
(
key
)
!=
plans
.
end
())
return
plans
[
key
];
const
int
rank
=
key
.
size
()
-
3
;
// dimension of fft
const
auto
components
=
key
[
rank
];
std
::
vector
<
int
>
n
(
rank
);
// size of individual fft
std
::
copy_n
(
key
.
begin
(),
rank
,
n
.
begin
());
const
int
howmany
=
components
;
// how many fft to compute
const
int
idist
=
1
,
odist
=
1
;
// components are next to each other in memory
const
int
istride
=
key
[
rank
+
1
]
*
components
,
ostride
=
key
[
rank
+
2
]
*
components
;
int
*
inembed
=
nullptr
,
*
onembed
=
nullptr
;
// row major
plan_t
cufft_plans
;
cufftResult
forward_res
=
cufftPlanMany
(
&
cufft_plans
.
first
.
_plan
,
rank
,
n
.
data
(),
inembed
,
istride
,
idist
,
onembed
,
ostride
,
odist
,
CUFFT_D2Z
,
howmany
);
cufftResult
backward_res
=
cufftPlanMany
(
&
cufft_plans
.
second
.
_plan
,
rank
,
n
.
data
(),
onembed
,
ostride
,
odist
,
inembed
,
istride
,
idist
,
CUFFT_Z2D
,
howmany
);
plans
[
key
]
=
std
::
move
(
cufft_plans
);
return
plans
[
key
];
}
}
// namespace tamaas
Event Timeline
Log In to Comment