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
82125ea2
Commit
82125ea2
authored
10 years ago
by
Chichi Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
use unsigned char for MPI IO
parent
3e2f5ff6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/field_descriptor.cpp
+14
-13
14 additions, 13 deletions
src/field_descriptor.cpp
src/field_descriptor.hpp
+14
-4
14 additions, 4 deletions
src/field_descriptor.hpp
test3.ipynb
+15
-7
15 additions, 7 deletions
test3.ipynb
with
43 additions
and
24 deletions
src/field_descriptor.cpp
+
14
−
13
View file @
82125ea2
...
@@ -86,6 +86,9 @@ field_descriptor::field_descriptor(
...
@@ -86,6 +86,9 @@ field_descriptor::field_descriptor(
tsubsizes
[
i
]
=
this
->
subsizes
[
i
];
tsubsizes
[
i
]
=
this
->
subsizes
[
i
];
tstarts
[
i
]
=
this
->
starts
[
i
];
tstarts
[
i
]
=
this
->
starts
[
i
];
}
}
tsizes
[
ndims
-
1
]
*=
sizeof
(
float
);
tsubsizes
[
ndims
-
1
]
*=
sizeof
(
float
);
tstarts
[
ndims
-
1
]
*=
sizeof
(
float
);
if
(
this
->
mpi_dtype
==
MPI_COMPLEX8
)
if
(
this
->
mpi_dtype
==
MPI_COMPLEX8
)
{
{
tsizes
[
ndims
-
1
]
*=
2
;
tsizes
[
ndims
-
1
]
*=
2
;
...
@@ -160,7 +163,7 @@ field_descriptor::field_descriptor(
...
@@ -160,7 +163,7 @@ field_descriptor::field_descriptor(
tsubsizes
,
tsubsizes
,
tstarts
,
tstarts
,
MPI_ORDER_C
,
MPI_ORDER_C
,
MPI_
FLOAT
,
MPI_
UNSIGNED_CHAR
,
&
this
->
mpi_array_dtype
);
&
this
->
mpi_array_dtype
);
MPI_Type_commit
(
&
this
->
mpi_array_dtype
);
MPI_Type_commit
(
&
this
->
mpi_array_dtype
);
}
}
...
@@ -210,15 +213,14 @@ field_descriptor::~field_descriptor()
...
@@ -210,15 +213,14 @@ field_descriptor::~field_descriptor()
int
field_descriptor
::
read
(
int
field_descriptor
::
read
(
const
char
*
fname
,
const
char
*
fname
,
void
*
buffer
,
void
*
buffer
)
const
char
*
datarep
)
{
{
if
(
this
->
subsizes
[
0
]
>
0
)
if
(
this
->
subsizes
[
0
]
>
0
)
{
{
MPI_Info
info
;
MPI_Info
info
;
MPI_Info_create
(
&
info
);
MPI_Info_create
(
&
info
);
MPI_File
f
;
MPI_File
f
;
int
read_size
=
this
->
local_size
;
int
read_size
=
this
->
local_size
*
sizeof
(
float
)
;
char
ffname
[
200
];
char
ffname
[
200
];
if
(
this
->
mpi_dtype
==
MPI_COMPLEX8
)
if
(
this
->
mpi_dtype
==
MPI_COMPLEX8
)
read_size
*=
2
;
read_size
*=
2
;
...
@@ -233,15 +235,15 @@ int field_descriptor::read(
...
@@ -233,15 +235,15 @@ int field_descriptor::read(
MPI_File_set_view
(
MPI_File_set_view
(
f
,
f
,
0
,
0
,
MPI_
FLOAT
,
MPI_
UNSIGNED_CHAR
,
this
->
mpi_array_dtype
,
this
->
mpi_array_dtype
,
datarep
,
"native"
,
info
);
info
);
MPI_File_read_all
(
MPI_File_read_all
(
f
,
f
,
buffer
,
buffer
,
read_size
,
read_size
,
MPI_
FLOAT
,
MPI_
UNSIGNED_CHAR
,
MPI_STATUS_IGNORE
);
MPI_STATUS_IGNORE
);
MPI_File_close
(
&
f
);
MPI_File_close
(
&
f
);
}
}
...
@@ -250,15 +252,14 @@ int field_descriptor::read(
...
@@ -250,15 +252,14 @@ int field_descriptor::read(
int
field_descriptor
::
write
(
int
field_descriptor
::
write
(
const
char
*
fname
,
const
char
*
fname
,
void
*
buffer
,
void
*
buffer
)
const
char
*
datarep
)
{
{
if
(
this
->
subsizes
[
0
]
>
0
)
if
(
this
->
subsizes
[
0
]
>
0
)
{
{
MPI_Info
info
;
MPI_Info
info
;
MPI_Info_create
(
&
info
);
MPI_Info_create
(
&
info
);
MPI_File
f
;
MPI_File
f
;
int
read_size
=
this
->
local_size
;
int
read_size
=
this
->
local_size
*
sizeof
(
float
)
;
char
ffname
[
200
];
char
ffname
[
200
];
if
(
this
->
mpi_dtype
==
MPI_COMPLEX8
)
if
(
this
->
mpi_dtype
==
MPI_COMPLEX8
)
read_size
*=
2
;
read_size
*=
2
;
...
@@ -273,15 +274,15 @@ int field_descriptor::write(
...
@@ -273,15 +274,15 @@ int field_descriptor::write(
MPI_File_set_view
(
MPI_File_set_view
(
f
,
f
,
0
,
0
,
MPI_
FLOAT
,
MPI_
UNSIGNED_CHAR
,
this
->
mpi_array_dtype
,
this
->
mpi_array_dtype
,
datarep
,
"native"
,
info
);
info
);
MPI_File_write_all
(
MPI_File_write_all
(
f
,
f
,
buffer
,
buffer
,
read_size
,
read_size
,
MPI_
FLOAT
,
MPI_
UNSIGNED_CHAR
,
MPI_STATUS_IGNORE
);
MPI_STATUS_IGNORE
);
MPI_File_close
(
&
f
);
MPI_File_close
(
&
f
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/field_descriptor.hpp
+
14
−
4
View file @
82125ea2
...
@@ -57,12 +57,10 @@ class field_descriptor
...
@@ -57,12 +57,10 @@ class field_descriptor
* */
* */
int
read
(
int
read
(
const
char
*
fname
,
const
char
*
fname
,
void
*
buffer
,
void
*
buffer
);
const
char
*
datarep
=
"native"
);
int
write
(
int
write
(
const
char
*
fname
,
const
char
*
fname
,
void
*
buffer
,
void
*
buffer
);
const
char
*
datarep
=
"native"
);
/* a function that generates the transposed descriptor.
/* a function that generates the transposed descriptor.
* don't forget to delete the result once you're done with it.
* don't forget to delete the result once you're done with it.
...
@@ -103,5 +101,17 @@ int fftwf_clip_zero_padding(
...
@@ -103,5 +101,17 @@ int fftwf_clip_zero_padding(
field_descriptor
*
f
,
field_descriptor
*
f
,
float
*
a
);
float
*
a
);
inline
float
btle
(
const
float
be
)
{
float
le
;
char
*
befloat
=
(
char
*
)
&
be
;
char
*
lefloat
=
(
char
*
)
&
le
;
lefloat
[
0
]
=
befloat
[
3
];
lefloat
[
1
]
=
befloat
[
2
];
lefloat
[
2
]
=
befloat
[
1
];
lefloat
[
3
]
=
befloat
[
0
];
return
le
;
}
#endif//FIELD_DESCRIPTOR
#endif//FIELD_DESCRIPTOR
This diff is collapsed.
Click to expand it.
test3.ipynb
+
15
−
7
View file @
82125ea2
{
{
"metadata": {
"metadata": {
"name": "",
"name": "",
"signature": "sha256:
41b656323632ba5dd67fcd6f67d6e62ab479be1edf0adc21548c493eb5da9b1d
"
"signature": "sha256:
966c6344a3d90cdf5a7423c96eebbfd82f41bd0e6556fcce769383cb4e93116c
"
},
},
"nbformat": 3,
"nbformat": 3,
"nbformat_minor": 0,
"nbformat_minor": 0,
...
@@ -63,8 +63,16 @@
...
@@ -63,8 +63,16 @@
],
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [
"prompt_number": 20
{
"output_type": "stream",
"stream": "stderr",
"text": [
"-c:15: RuntimeWarning: divide by zero encountered in true_divide\n"
]
}
],
"prompt_number": 2
},
},
{
{
"cell_type": "code",
"cell_type": "code",
...
@@ -147,7 +155,7 @@
...
@@ -147,7 +155,7 @@
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"prompt_number":
56
"prompt_number":
3
},
},
{
{
"cell_type": "code",
"cell_type": "code",
...
@@ -200,7 +208,7 @@
...
@@ -200,7 +208,7 @@
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"prompt_number": 5
2
"prompt_number": 5
},
},
{
{
"cell_type": "code",
"cell_type": "code",
...
@@ -241,11 +249,11 @@
...
@@ -241,11 +249,11 @@
"text": [
"text": [
"0.0\n",
"0.0\n",
"distance is small\n",
"distance is small\n",
"14.
9705
\n"
"14.
4104
\n"
]
]
}
}
],
],
"prompt_number":
57
"prompt_number":
6
},
},
{
{
"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