Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PuReMD
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
SParTA
PuReMD
Commits
67b2c00d
Commit
67b2c00d
authored
8 years ago
by
Kurt A. O'Hearn
Browse files
Options
Downloads
Patches
Plain Diff
sPuReMD: parameterize trisolve via level sched for better memory usage.
parent
854011d2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
sPuReMD/src/GMRES.c
+19
-8
19 additions, 8 deletions
sPuReMD/src/GMRES.c
sPuReMD/src/forces.c
+10
-1
10 additions, 1 deletion
sPuReMD/src/forces.c
sPuReMD/src/mytypes.h
+4
-3
4 additions, 3 deletions
sPuReMD/src/mytypes.h
sPuReMD/src/testmd.c
+2
-0
2 additions, 0 deletions
sPuReMD/src/testmd.c
with
35 additions
and
12 deletions
sPuReMD/src/GMRES.c
+
19
−
8
View file @
67b2c00d
...
@@ -306,9 +306,9 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
...
@@ -306,9 +306,9 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
if
(
row_levels
==
NULL
||
level_rows
==
NULL
||
level_rows_cnt
==
NULL
)
if
(
row_levels
==
NULL
||
level_rows
==
NULL
||
level_rows_cnt
==
NULL
)
{
{
if
(
(
row_levels
=
(
unsigned
int
*
)
malloc
(
LU
->
n
*
sizeof
(
unsigned
int
)))
==
NULL
if
(
(
row_levels
=
(
unsigned
int
*
)
malloc
(
(
size_t
)
LU
->
n
*
sizeof
(
unsigned
int
)))
==
NULL
||
(
level_rows
=
(
unsigned
int
*
)
malloc
(
LU
->
n
*
LU
->
n
*
sizeof
(
unsigned
int
)))
==
NULL
||
(
level_rows
=
(
unsigned
int
*
)
malloc
(
MAX_ROWS_PER_LEVEL
*
(
size_t
)
LU
->
n
*
sizeof
(
unsigned
int
)))
==
NULL
||
(
level_rows_cnt
=
(
unsigned
int
*
)
malloc
(
LU
->
n
*
sizeof
(
unsigned
int
)))
==
NULL
)
||
(
level_rows_cnt
=
(
unsigned
int
*
)
malloc
(
(
size_t
)
LU
->
n
*
sizeof
(
unsigned
int
)))
==
NULL
)
{
{
fprintf
(
stderr
,
"Not enough space for triangular solve via level scheduling. Terminating...
\n
"
);
fprintf
(
stderr
,
"Not enough space for triangular solve via level scheduling. Terminating...
\n
"
);
exit
(
INSUFFICIENT_MEMORY
);
exit
(
INSUFFICIENT_MEMORY
);
...
@@ -333,8 +333,14 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
...
@@ -333,8 +333,14 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
levels
=
MAX
(
levels
,
local_level
+
1
);
levels
=
MAX
(
levels
,
local_level
+
1
);
row_levels
[
i
]
=
local_level
;
row_levels
[
i
]
=
local_level
;
level_rows
[
local_level
*
LU
->
n
+
level_rows_cnt
[
local_level
]]
=
i
;
level_rows
[
local_level
*
MAX_ROWS_PER_LEVEL
+
level_rows_cnt
[
local_level
]]
=
i
;
++
level_rows_cnt
[
local_level
];
++
level_rows_cnt
[
local_level
];
if
(
level_rows_cnt
[
local_level
]
>=
MAX_ROWS_PER_LEVEL
)
{
fprintf
(
stderr
,
"Not enough space for triangular solve via level scheduling"
);
fprintf
(
stderr
,
" (MAX_ROWS_PER_LEVEL). Terminating...
\n
"
);
exit
(
INSUFFICIENT_MEMORY
);
}
}
}
}
}
else
else
...
@@ -349,8 +355,14 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
...
@@ -349,8 +355,14 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
levels
=
MAX
(
levels
,
local_level
+
1
);
levels
=
MAX
(
levels
,
local_level
+
1
);
row_levels
[
i
]
=
local_level
;
row_levels
[
i
]
=
local_level
;
level_rows
[
local_level
*
LU
->
n
+
level_rows_cnt
[
local_level
]]
=
i
;
level_rows
[
local_level
*
MAX_ROWS_PER_LEVEL
+
level_rows_cnt
[
local_level
]]
=
i
;
++
level_rows_cnt
[
local_level
];
++
level_rows_cnt
[
local_level
];
if
(
level_rows_cnt
[
local_level
]
>=
MAX_ROWS_PER_LEVEL
)
{
fprintf
(
stderr
,
"Not enough space for triangular solve via level scheduling"
);
fprintf
(
stderr
,
" (MAX_ROWS_PER_LEVEL). Terminating...
\n
"
);
exit
(
INSUFFICIENT_MEMORY
);
}
}
}
}
}
}
}
...
@@ -364,7 +376,7 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
...
@@ -364,7 +376,7 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
default(none) private(j, pj, local_row) shared(stderr, i, level_rows_cnt, level_rows)
default(none) private(j, pj, local_row) shared(stderr, i, level_rows_cnt, level_rows)
for
(
j
=
0
;
j
<
level_rows_cnt
[
i
];
++
j
)
for
(
j
=
0
;
j
<
level_rows_cnt
[
i
];
++
j
)
{
{
local_row
=
level_rows
[
i
*
LU
->
n
+
j
];
local_row
=
level_rows
[
i
*
MAX_ROWS_PER_LEVEL
+
j
];
x
[
local_row
]
=
y
[
local_row
];
x
[
local_row
]
=
y
[
local_row
];
for
(
pj
=
LU
->
start
[
local_row
];
pj
<
LU
->
start
[
local_row
+
1
]
-
1
;
++
pj
)
for
(
pj
=
LU
->
start
[
local_row
];
pj
<
LU
->
start
[
local_row
+
1
]
-
1
;
++
pj
)
{
{
...
@@ -383,7 +395,7 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
...
@@ -383,7 +395,7 @@ static void tri_solve_level_sched( const sparse_matrix * const LU, const real *
default(none) private(j, pj, local_row) shared(i, level_rows_cnt, level_rows)
default(none) private(j, pj, local_row) shared(i, level_rows_cnt, level_rows)
for
(
j
=
0
;
j
<
level_rows_cnt
[
i
];
++
j
)
for
(
j
=
0
;
j
<
level_rows_cnt
[
i
];
++
j
)
{
{
local_row
=
level_rows
[
i
*
LU
->
n
+
j
];
local_row
=
level_rows
[
i
*
MAX_ROWS_PER_LEVEL
+
j
];
x
[
local_row
]
=
y
[
local_row
];
x
[
local_row
]
=
y
[
local_row
];
for
(
pj
=
LU
->
start
[
local_row
]
+
1
;
pj
<
LU
->
start
[
local_row
+
1
];
++
pj
)
for
(
pj
=
LU
->
start
[
local_row
]
+
1
;
pj
<
LU
->
start
[
local_row
+
1
];
++
pj
)
{
{
...
@@ -787,7 +799,6 @@ int GMRES( const static_storage * const workspace, const control_params * const
...
@@ -787,7 +799,6 @@ int GMRES( const static_storage * const workspace, const control_params * const
}
}
}
}
workspace
->
h
[
j
+
1
][
j
]
=
Norm
(
workspace
->
v
[
j
+
1
],
N
);
workspace
->
h
[
j
+
1
][
j
]
=
Norm
(
workspace
->
v
[
j
+
1
],
N
);
Vector_Scale
(
workspace
->
v
[
j
+
1
],
Vector_Scale
(
workspace
->
v
[
j
+
1
],
1
.
/
workspace
->
h
[
j
+
1
][
j
],
workspace
->
v
[
j
+
1
],
N
);
1
.
/
workspace
->
h
[
j
+
1
][
j
],
workspace
->
v
[
j
+
1
],
N
);
...
...
This diff is collapsed.
Click to expand it.
sPuReMD/src/forces.c
+
10
−
1
View file @
67b2c00d
...
@@ -133,10 +133,14 @@ void Compute_NonBonded_Forces( reax_system *system, control_params *control,
...
@@ -133,10 +133,14 @@ void Compute_NonBonded_Forces( reax_system *system, control_params *control,
#endif
#endif
if
(
control
->
tabulate
==
0
)
if
(
control
->
tabulate
==
0
)
{
vdW_Coulomb_Energy
(
system
,
control
,
data
,
workspace
,
lists
,
out_control
);
vdW_Coulomb_Energy
(
system
,
control
,
data
,
workspace
,
lists
,
out_control
);
}
else
else
{
Tabulated_vdW_Coulomb_Energy
(
system
,
control
,
data
,
workspace
,
Tabulated_vdW_Coulomb_Energy
(
system
,
control
,
data
,
workspace
,
lists
,
out_control
);
lists
,
out_control
);
}
#if defined(DEBUG_FOCUS)
#if defined(DEBUG_FOCUS)
fprintf
(
stderr
,
"nonb forces - "
);
fprintf
(
stderr
,
"nonb forces - "
);
#endif
#endif
...
@@ -933,8 +937,13 @@ void Compute_Forces( reax_system *system, control_params *control,
...
@@ -933,8 +937,13 @@ void Compute_Forces( reax_system *system, control_params *control,
t_start
=
Get_Time
(
);
t_start
=
Get_Time
(
);
if
(
!
control
->
tabulate
)
if
(
!
control
->
tabulate
)
{
Init_Forces
(
system
,
control
,
data
,
workspace
,
lists
,
out_control
);
Init_Forces
(
system
,
control
,
data
,
workspace
,
lists
,
out_control
);
else
Init_Forces_Tab
(
system
,
control
,
data
,
workspace
,
lists
,
out_control
);
}
else
{
Init_Forces_Tab
(
system
,
control
,
data
,
workspace
,
lists
,
out_control
);
}
t_elapsed
=
Get_Timing_Info
(
t_start
);
t_elapsed
=
Get_Timing_Info
(
t_start
);
data
->
timing
.
init_forces
+=
t_elapsed
;
data
->
timing
.
init_forces
+=
t_elapsed
;
#if defined(DEBUG_FOCUS)
#if defined(DEBUG_FOCUS)
...
...
This diff is collapsed.
Click to expand it.
sPuReMD/src/mytypes.h
+
4
−
3
View file @
67b2c00d
...
@@ -115,6 +115,7 @@
...
@@ -115,6 +115,7 @@
#define MAX_ITR 10
#define MAX_ITR 10
#define RESTART 50
#define RESTART 50
#define MAX_ROWS_PER_LEVEL 10000
/* triangular solve using level scheduling */
#define ZERO 0.000000000000000e+00
#define ZERO 0.000000000000000e+00
#define ALMOST_ZERO 1e-10
#define ALMOST_ZERO 1e-10
...
@@ -725,9 +726,9 @@ typedef struct
...
@@ -725,9 +726,9 @@ typedef struct
* */
* */
typedef
struct
typedef
struct
{
{
int
n
,
m
;
unsigned
int
n
,
m
;
int
*
start
;
unsigned
int
*
start
;
int
*
j
;
unsigned
int
*
j
;
real
*
val
;
real
*
val
;
}
sparse_matrix
;
}
sparse_matrix
;
...
...
This diff is collapsed.
Click to expand it.
sPuReMD/src/testmd.c
+
2
−
0
View file @
67b2c00d
...
@@ -191,7 +191,9 @@ int main(int argc, char* argv[])
...
@@ -191,7 +191,9 @@ int main(int argc, char* argv[])
for
(
;
data
.
step
<=
control
.
nsteps
;
data
.
step
++
)
for
(
;
data
.
step
<=
control
.
nsteps
;
data
.
step
++
)
{
{
if
(
control
.
T_mode
)
if
(
control
.
T_mode
)
{
Temperature_Control
(
&
control
,
&
data
,
&
out_control
);
Temperature_Control
(
&
control
,
&
data
,
&
out_control
);
}
Evolve
(
&
system
,
&
control
,
&
data
,
&
workspace
,
&
lists
,
&
out_control
);
Evolve
(
&
system
,
&
control
,
&
data
,
&
workspace
,
&
lists
,
&
out_control
);
Post_Evolve
(
&
system
,
&
control
,
&
data
,
&
workspace
,
&
lists
,
&
out_control
);
Post_Evolve
(
&
system
,
&
control
,
&
data
,
&
workspace
,
&
lists
,
&
out_control
);
Output_Results
(
&
system
,
&
control
,
&
data
,
&
workspace
,
&
lists
,
&
out_control
);
Output_Results
(
&
system
,
&
control
,
&
data
,
&
workspace
,
&
lists
,
&
out_control
);
...
...
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