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
49a5190c
Commit
49a5190c
authored
Jul 07, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added assertion to segfaulting function.
parent
186e1e12
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
modsim/ass4_taddeus/vibstring/Makefile
modsim/ass4_taddeus/vibstring/Makefile
+1
-1
modsim/ass4_taddeus/vibstring/par.c
modsim/ass4_taddeus/vibstring/par.c
+9
-7
modsim/ass4_taddeus/vibstring/par.sh
modsim/ass4_taddeus/vibstring/par.sh
+3
-3
No files found.
modsim/ass4_taddeus/vibstring/Makefile
View file @
49a5190c
CC
=
mpicc
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
LDFLAGS
=
-lm
all
:
seq par
all
:
seq par
...
...
modsim/ass4_taddeus/vibstring/par.c
View file @
49a5190c
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <string.h>
#include <string.h>
#include <math.h>
#include <math.h>
#include <mpi.h>
#include <mpi.h>
#include <assert.h>
double
**
y
=
NULL
,
dx
;
double
**
y
=
NULL
,
dx
;
int
steps
,
time
,
start
,
rank
,
tasks
;
int
steps
,
time
,
start
,
rank
,
tasks
;
...
@@ -21,6 +22,7 @@ static inline int last_node() {
...
@@ -21,6 +22,7 @@ static inline int last_node() {
*/
*/
void
connect
(
int
state
)
{
void
connect
(
int
state
)
{
double
send
[
2
],
recv
[
2
];
double
send
[
2
],
recv
[
2
];
assert
(
tasks
);
int
source
=
(
rank
-
1
+
tasks
)
%
tasks
,
target
=
(
rank
+
1
)
%
tasks
;
int
source
=
(
rank
-
1
+
tasks
)
%
tasks
,
target
=
(
rank
+
1
)
%
tasks
;
MPI_Status
status
;
MPI_Status
status
;
...
@@ -144,6 +146,13 @@ int main(int argc, char **argv) {
...
@@ -144,6 +146,13 @@ int main(int argc, char **argv) {
void
(
*
init_method
)(
double
,
double
);
void
(
*
init_method
)(
double
,
double
);
double
l
,
tau
,
constant
;
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
// Initialize and setup MPI
if
(
(
error
=
MPI_Init
(
&
argc
,
&
argv
))
!=
MPI_SUCCESS
)
{
if
(
(
error
=
MPI_Init
(
&
argc
,
&
argv
))
!=
MPI_SUCCESS
)
{
printf
(
"MPI_init failed (error %d)
\n
"
,
error
);
printf
(
"MPI_init failed (error %d)
\n
"
,
error
);
...
@@ -154,13 +163,6 @@ int main(int argc, char **argv) {
...
@@ -154,13 +163,6 @@ int main(int argc, char **argv) {
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
tasks
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
tasks
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
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"
)
)
{
if
(
!
strcmp
(
argv
[
1
],
"sinus"
)
)
{
init_method
=
init_sinus
;
init_method
=
init_sinus
;
}
else
if
(
!
strcmp
(
argv
[
1
],
"plucked"
)
)
{
}
else
if
(
!
strcmp
(
argv
[
1
],
"plucked"
)
)
{
...
...
modsim/ass4_taddeus/vibstring/par.sh
View file @
49a5190c
#!/bin/sh
#!/bin/
ba
sh
NUM_PROCESSES
=
${
1
-4
}
# Default: 4 processes
NUM_PROCESSES
=
${
1
-4
}
# Default: 4 processes
#RSH_AGENT=rsh
#RSH_AGENT=rsh
#MPI_HOSTFILE=~/.mpirun.machines
#MPI_HOSTFILE=~/.mpirun.machines
PROGRAM_EXEC
=
par
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 \
#mpirun -np $NUM_PROCESSES --mca pls_rsh_agent $RSH_AGENT \
# --hostfile $MPI_HOSTFILE $PROGRAM_EXEC
# --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