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
8ca8c52e
Commit
8ca8c52e
authored
May 17, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ModSim ass4 taddeus: Added files for sequential vibrating string.
parent
7cf913bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
1 deletion
+63
-1
modsim/ass4_taddeus/ring/ring.c
modsim/ass4_taddeus/ring/ring.c
+1
-1
modsim/ass4_taddeus/vibstring/Makefile
modsim/ass4_taddeus/vibstring/Makefile
+8
-0
modsim/ass4_taddeus/vibstring/seq.c
modsim/ass4_taddeus/vibstring/seq.c
+54
-0
No files found.
modsim/ass4_taddeus/ring/ring.c
View file @
8ca8c52e
...
@@ -22,7 +22,7 @@ void master(int tasks) {
...
@@ -22,7 +22,7 @@ void master(int tasks) {
// generate data to send
// generate data to send
for
(
i
=
0
;
i
<
data_size
;
i
++
)
for
(
i
=
0
;
i
<
data_size
;
i
++
)
sent
[
i
]
=
.
0
;
sent
[
i
]
=
(
float
)
i
;
// Increase the message length with a fixed STRIDE
// Increase the message length with a fixed STRIDE
for
(
size
=
STRIDE
;
size
<=
data_size
;
size
+=
STRIDE
)
{
for
(
size
=
STRIDE
;
size
<=
data_size
;
size
+=
STRIDE
)
{
...
...
modsim/ass4_taddeus/vibstring/Makefile
0 → 100644
View file @
8ca8c52e
CC
=
mpicc
CFLAGS
=
-Wall
-Wextra
-pedantic
-std
=
c99
-O2
all
:
vibstring
vibstring
:
main.o
clean
:
rm
-vf
*
.o vibstring
modsim/ass4_taddeus/vibstring/seq.c
0 → 100644
View file @
8ca8c52e
#include <stdlib.h>
#include <stdio.h>
//#define DEBUG
#define LOOP 100
#define STRIDE 10000
#define REPEAT 7
const
int
data_size
=
LOOP
*
STRIDE
;
/*
* The master task measures the time between the sending and receiving of data.
*/
void
(
int
tasks
,
int
rank
)
{
double
*
data
=
malloc
(
data_size
*
sizeof
(
double
));
MPI_Status
status
;
int
size
,
measurement
,
source
=
(
rank
-
1
+
tasks
)
%
tasks
,
target
=
(
rank
+
1
)
%
tasks
;
// Increase the message length with a fixed STRIDE
for
(
size
=
STRIDE
;
size
<=
data_size
;
size
+=
STRIDE
)
{
// Repeat the measurement
for
(
measurement
=
1
;
measurement
<=
REPEAT
;
measurement
++
)
{
MPI_Recv
(
data
,
size
,
MPI_DOUBLE
,
source
,
MPI_ANY_TAG
,
MPI_COMM_WORLD
,
&
status
);
MPI_Send
(
data
,
size
,
MPI_DOUBLE
,
target
,
0
,
MPI_COMM_WORLD
);
}
}
free
(
data
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
tasks
,
rank
,
error
;
if
(
(
error
=
MPI_Init
(
&
argc
,
&
argv
))
!=
MPI_SUCCESS
)
{
printf
(
"MPI_init failed (error %d)
\n
"
,
error
);
MPI_Abort
(
MPI_COMM_WORLD
,
error
);
return
EXIT_FAILURE
;
}
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
tasks
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
if
(
!
rank
)
master
(
tasks
);
else
slave
(
tasks
,
rank
);
MPI_Finalize
();
return
EXIT_SUCCESS
;
}
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