Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uva
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
Model registry
Operate
Environments
Monitor
Incidents
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
Taddeüs Kroes
uva
Commits
49a5190c
Commit
49a5190c
authored
13 years ago
by
Sander Mathijs van Veen
Browse files
Options
Downloads
Patches
Plain Diff
Added assertion to segfaulting function.
parent
186e1e12
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modsim/ass4_taddeus/vibstring/Makefile
+1
-1
1 addition, 1 deletion
modsim/ass4_taddeus/vibstring/Makefile
modsim/ass4_taddeus/vibstring/par.c
+9
-7
9 additions, 7 deletions
modsim/ass4_taddeus/vibstring/par.c
modsim/ass4_taddeus/vibstring/par.sh
+3
-3
3 additions, 3 deletions
modsim/ass4_taddeus/vibstring/par.sh
with
13 additions
and
11 deletions
modsim/ass4_taddeus/vibstring/Makefile
+
1
−
1
View file @
49a5190c
CC
=
mpicc
CFLAGS
=
-Wall
-Wextra
-pedantic
-std
=
c99
-O0
-D_GNU_SOURCE
CFLAGS
=
-Wall
-Wextra
-pedantic
-std
=
c99
-O0
-D_GNU_SOURCE
-g
LDFLAGS
=
-lm
all
:
seq par
...
...
This diff is collapsed.
Click to expand it.
modsim/ass4_taddeus/vibstring/par.c
+
9
−
7
View file @
49a5190c
...
...
@@ -3,6 +3,7 @@
#include
<string.h>
#include
<math.h>
#include
<mpi.h>
#include
<assert.h>
double
**
y
=
NULL
,
dx
;
int
steps
,
time
,
start
,
rank
,
tasks
;
...
...
@@ -21,6 +22,7 @@ static inline int last_node() {
*/
void
connect
(
int
state
)
{
double
send
[
2
],
recv
[
2
];
assert
(
tasks
);
int
source
=
(
rank
-
1
+
tasks
)
%
tasks
,
target
=
(
rank
+
1
)
%
tasks
;
MPI_Status
status
;
...
...
@@ -144,6 +146,13 @@ int main(int argc, char **argv) {
void
(
*
init_method
)(
double
,
double
);
double
l
,
tau
,
constant
;
// Parse arguments
if
(
argc
<
7
)
{
printf
(
"Usage: %s INIT_METHOD CALCULATION_STEPS LENGTH DX TAU N|XP
\n
"
,
argv
[
0
]);
return
EXIT_FAILURE
;
}
// Initialize and setup MPI
if
(
(
error
=
MPI_Init
(
&
argc
,
&
argv
))
!=
MPI_SUCCESS
)
{
printf
(
"MPI_init failed (error %d)
\n
"
,
error
);
...
...
@@ -154,13 +163,6 @@ int main(int argc, char **argv) {
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
tasks
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
// Parse arguments
if
(
argc
<
7
)
{
printf
(
"Usage: %s INIT_METHOD CALCULATION_STEPS LENGTH DX TAU N|XP
\n
"
,
argv
[
0
]);
return
EXIT_FAILURE
;
}
if
(
!
strcmp
(
argv
[
1
],
"sinus"
)
)
{
init_method
=
init_sinus
;
}
else
if
(
!
strcmp
(
argv
[
1
],
"plucked"
)
)
{
...
...
This diff is collapsed.
Click to expand it.
modsim/ass4_taddeus/vibstring/par.sh
+
3
−
3
View file @
49a5190c
#!/bin/sh
#!/bin/
ba
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
ARGS
=
"
sinus 1001 1 .01 1 1
"
mpirun
-np
$NUM_PROCESSES
$PROGRAM_EXEC
$
@
mpirun
-np
$NUM_PROCESSES
$PROGRAM_EXEC
$
ARGS
#mpirun -np $NUM_PROCESSES --mca pls_rsh_agent $RSH_AGENT \
# --hostfile $MPI_HOSTFILE $PROGRAM_EXEC
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