Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
7ae982f8
Commit
7ae982f8
authored
10 years ago
by
Chichi Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
use std::copy instead of element-wise copy
parent
3245d1ec
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/field_descriptor.cpp
+19
-28
19 additions, 28 deletions
src/field_descriptor.cpp
test.ipynb
+4
-4
4 additions, 4 deletions
test.ipynb
with
23 additions
and
32 deletions
src/field_descriptor.cpp
+
19
−
28
View file @
7ae982f8
...
@@ -148,37 +148,28 @@ int field_descriptor::transpose(
...
@@ -148,37 +148,28 @@ int field_descriptor::transpose(
// for 3D transposition, the input data is messed up
// for 3D transposition, the input data is messed up
fftwf_plan
tplan
;
fftwf_plan
tplan
;
ptrdiff_t
dim1
;
ptrdiff_t
dim1
;
switch
(
this
->
ndims
)
if
(
this
->
ndims
==
3
)
{
{
case
2
:
// transpose the two local dimensions 1 and 2
dim1
=
this
->
sizes
[
1
];
float
*
atmp
;
break
;
atmp
=
fftwf_alloc_real
(
this
->
slice_size
);
case
3
:
for
(
int
k
=
0
;
k
<
this
->
subsizes
[
0
];
k
++
)
// transpose the two local dimensions 1 and 2
{
dim1
=
this
->
sizes
[
1
]
*
this
->
sizes
[
2
];
// put transposed slice in atmp
float
*
atmp
;
for
(
int
j
=
0
;
j
<
this
->
sizes
[
1
];
j
++
)
atmp
=
(
float
*
)
malloc
(
dim1
*
sizeof
(
float
));
for
(
int
i
=
0
;
i
<
this
->
sizes
[
2
];
i
++
)
for
(
int
k
=
0
;
k
<
this
->
subsizes
[
0
];
k
++
)
atmp
[
i
*
this
->
sizes
[
1
]
+
j
]
=
{
input
[(
k
*
this
->
sizes
[
1
]
+
j
)
*
this
->
sizes
[
2
]
+
i
];
// put transposed slice in atmp
// copy back transposed slice
for
(
int
j
=
0
;
j
<
this
->
sizes
[
1
];
j
++
)
std
::
copy
(
for
(
int
i
=
0
;
i
<
this
->
sizes
[
2
];
i
++
)
atmp
,
atmp
[
i
*
this
->
sizes
[
1
]
+
j
]
=
atmp
+
this
->
slice_size
,
input
[(
k
*
this
->
sizes
[
1
]
+
j
)
*
this
->
sizes
[
2
]
+
i
];
input
+
k
*
this
->
slice_size
);
// copy back transposed slice
}
for
(
int
j
=
0
;
j
<
this
->
sizes
[
2
];
j
++
)
fftwf_free
(
atmp
);
for
(
int
i
=
0
;
i
<
this
->
sizes
[
1
];
i
++
)
input
[(
k
*
this
->
sizes
[
2
]
+
j
)
*
this
->
sizes
[
1
]
+
i
]
=
atmp
[
j
*
this
->
sizes
[
1
]
+
i
];
}
free
(
atmp
);
break
;
default
:
return
EXIT_FAILURE
;
break
;
}
}
tplan
=
fftwf_mpi_plan_transpose
(
tplan
=
fftwf_mpi_plan_transpose
(
this
->
sizes
[
0
],
dim1
,
this
->
sizes
[
0
],
this
->
slice_size
,
input
,
output
,
input
,
output
,
this
->
comm
,
this
->
comm
,
FFTW_ESTIMATE
);
FFTW_ESTIMATE
);
...
...
This diff is collapsed.
Click to expand it.
test.ipynb
+
4
−
4
View file @
7ae982f8
{
{
"metadata": {
"metadata": {
"name": "",
"name": "",
"signature": "sha256:
e257a2ed63efdfaaad53572bf411ce350bc2da0748cbff2374ba511f3a837cbc
"
"signature": "sha256:
9cf3a6ad81b4021d61957c3d2805faad24a447da957672fc0268ff9b398c6dee
"
},
},
"nbformat": 3,
"nbformat": 3,
"nbformat_minor": 0,
"nbformat_minor": 0,
...
@@ -187,7 +187,7 @@
...
@@ -187,7 +187,7 @@
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"prompt_number": 5
1
"prompt_number": 5
4
},
},
{
{
"cell_type": "code",
"cell_type": "code",
...
@@ -215,11 +215,11 @@
...
@@ -215,11 +215,11 @@
"output_type": "stream",
"output_type": "stream",
"stream": "stdout",
"stream": "stdout",
"text": [
"text": [
"
3.09944
e-06\n"
"
2.86102
e-06\n"
]
]
}
}
],
],
"prompt_number": 5
2
"prompt_number": 5
5
},
},
{
{
"cell_type": "code",
"cell_type": "code",
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment