Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
ff0f13b4
Commit
ff0f13b4
authored
Jul 07, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ModSim ass4 taddeus: Added shell script for mpi.
parent
b545fb9b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
modsim/ass4_taddeus/vibstring/par.c
modsim/ass4_taddeus/vibstring/par.c
+12
-6
modsim/ass4_taddeus/vibstring/par.sh
modsim/ass4_taddeus/vibstring/par.sh
+10
-0
No files found.
modsim/ass4_taddeus/vibstring/par.c
View file @
ff0f13b4
...
...
@@ -75,13 +75,16 @@ void init_plucked(double l, double xp) {
void
print
(
int
index
)
{
for
(
int
i
=
0
;
i
<
steps
;
i
++
)
{
if
(
i
)
if
(
i
||
rank
)
printf
(
" "
);
printf
(
PRINT_FORMAT
,
y
[
index
][
i
]);
}
if
(
last_node
()
)
puts
(
""
);
fflush
(
stdout
);
}
#endif
...
...
@@ -94,7 +97,7 @@ void calculate_steps(int time, double tau) {
// Calculate the position over the entire string at time dt using the
// position at t = 0 and the information that y(x, -dt) == y(x, dt)
for
(
i
=
1
;
i
<
steps
-
1
;
i
++
)
{
for
(
i
=
1
;
i
<
=
steps
;
i
++
)
{
x
=
i
*
dx
;
y
[
1
][
i
]
=
y
[
0
][
i
]
+
.
5
*
tau
*
tau
*
(
y
[
0
][
i
-
1
]
-
2
*
y
[
0
][
i
]
+
y
[
0
][
i
+
1
]);
...
...
@@ -106,10 +109,11 @@ void calculate_steps(int time, double tau) {
if
(
i
)
printf
(
" "
);
printf
(
PRINT_FORMAT
,
i
*
dx
);
printf
(
PRINT_FORMAT
,
(
i
+
start
)
*
dx
);
}
puts
(
""
);
fflush
(
stdout
);
// Print init states
print
(
prev
);
...
...
@@ -118,7 +122,7 @@ void calculate_steps(int time, double tau) {
// Iterate over the length of the string for each time interval step
for
(
t
=
2
;
t
<
time
;
t
++
)
{
for
(
i
=
1
;
i
<
steps
-
1
;
i
++
)
{
for
(
i
=
1
;
i
<
=
steps
;
i
++
)
{
y
[
next
][
i
]
=
2
*
y
[
current
][
i
]
-
y
[
prev
][
i
]
+
tau
*
tau
*
(
y
[
current
][
i
-
1
]
-
2
*
y
[
current
][
i
]
+
y
[
current
][
i
+
1
]);
}
...
...
@@ -130,6 +134,8 @@ void calculate_steps(int time, double tau) {
prev
=
current
;
current
=
next
;
next
=
(
next
+
1
)
%
3
;
connect
(
next
);
}
}
...
...
@@ -201,7 +207,7 @@ int main(int argc, char **argv) {
free
(
y
);
// Finalize
m
PI
// Finalize
M
PI
MPI_Finalize
();
return
EXIT_SUCCESS
;
...
...
modsim/ass4_taddeus/vibstring/par.sh
0 → 100755
View file @
ff0f13b4
#!/bin/sh
NUM_PROCESSES
=
${
1
-4
}
# Default: 4 processes
#RSH_AGENT=rsh
#MPI_HOSTFILE=~/.mpirun.machines
PROGRAM_EXEC
=
par
ARGS
=
sinus 1001 1 .01 1 1
mpirun
-np
$NUM_PROCESSES
$PROGRAM_EXEC
#mpirun -np $NUM_PROCESSES --mca pls_rsh_agent $RSH_AGENT \
# --hostfile $MPI_HOSTFILE $PROGRAM_EXEC
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment