Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96647327
otf2_support.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 29, 11:18
Size
3 KB
Mime Type
text/x-c
Expires
Tue, Dec 31, 11:18 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23222347
Attached To
R3130 Multi-level Scheduling in Large Scale High Performance Computers
otf2_support.c
View Options
/*********************************************************************************
* Copyright (c) 2016 *
* Ali Omar abdelazim Mohammed <ali.mohammed@unibas.ch> *
* University of Basel, Switzerland *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the license (GNU LGPL) which comes with this package. *
*********************************************************************************/
#include <ctype.h>
typedef
struct
{
int
host_ID
;
int
core_ID
;
int
batch_ID
;
int
chunk_size
;
int
start_task_ID
;
int
end_task_ID
;
double
startTime
;
double
endTime
;
}
Chunk_t
;
typedef
struct
{
int
host_ID
;
int
num_cores
;
}
Platform_t
;
/*helper functions to write an input file to hippie2_modified */
//returns the integer number in a string
int
find_number
(
const
char
*
str
)
{
while
(
*
str
++!=
'\0'
)
{
if
(
isdigit
(
*
str
))
{
return
atoi
(
str
);
}
}
return
-
1
;
}
void
write_trace_file
(
char
*
tracefile
,
char
*
platform_file
,
int
NHOSTS
,
int
num_tasks
,
char
*
jobfile
,
int
total_avail_cores
,
int
METHOD
,
Platform_t
*
otf_locations
,
int
JobID
,
Chunk_t
*
applicaton_chunks
,
int
num_chunks
,
double
makespan
,
int
trace_append_flag
)
{
//tracefile pointer
FILE
*
fp
;
fp
=
fopen
(
tracefile
,
"w"
);
if
(
!
trace_append_flag
)
{
fprintf
(
fp
,
"palform file: %s
\n
"
,
platform_file
);
fprintf
(
fp
,
"#hosts = %d
\n
"
,
NHOSTS
);
fprintf
(
fp
,
"#tasks = %d
\n
"
,
num_tasks
);
fprintf
(
fp
,
"Job File: %s
\n
"
,
jobfile
);
//XBT_INFO("Simulation Time: %7.24f", SD_get_clock());
fprintf
(
fp
,
"Number of Cores: %d
\n
"
,
total_avail_cores
);
fprintf
(
fp
,
"---------------------------------------------------------------------------------
\n
"
);
switch
(
METHOD
)
{
case
1
:
//self scheduling
fprintf
(
fp
,
"DLS Algorithm: Self Scheduling
\n
"
);
break
;
case
2
:
//static chunking
fprintf
(
fp
,
"DLS Algorithm: Static Chunking
\n
"
);
break
;
case
3
:
//GSS
fprintf
(
fp
,
"DLS Algorithm: Guided Self Scheduling
\n
"
);
break
;
case
4
:
//factoring
fprintf
(
fp
,
"DLS Algorithm: Factoring
\n
"
);
break
;
case
5
:
// Fixed Size Chunking
fprintf
(
fp
,
"DLS Algorithm: Fixed Size Chunking
\n
"
);
break
;
}
fprintf
(
fp
,
"
\n\n
"
);
//print locations
fprintf
(
fp
,
"hostID
\t
#cores
\n
"
);
for
(
int
i
=
0
;
i
<
NHOSTS
;
i
++
)
{
fprintf
(
fp
,
"%d
\t
%d
\n
"
,
otf_locations
[
i
].
host_ID
,
otf_locations
[
i
].
num_cores
);
}
fprintf
(
fp
,
"
\n\n
"
);
//----------------------------- print job table-------------------------------------
fprintf
(
fp
,
"index
\t
JobID
\n
"
);
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
fprintf
(
fp
,
"%d
\t
%d
\n
"
,
i
,
JobID
);
}
fprintf
(
fp
,
"
\n\n
"
);
// ---------------------------------------------------------------------------------
//print chunks information to file
fprintf
(
fp
,
"chunkID
\t
batchID
\t
jobID
\t
#Tasks
\t
hostID
\t
coreID
\t
startTime
\t
endTime
\n
"
);
//header
}
// appending data
for
(
int
i
=
0
;
i
<
num_chunks
;
i
++
)
{
fprintf
(
fp
,
"%d
\t
%d
\t
%d
\t
%d
\t
%d
\t
%d
\t
%lf
\t
%lf
\n
"
,
i
,
applicaton_chunks
[
i
].
batch_ID
,(
int
)
JobID
,
applicaton_chunks
[
i
].
chunk_size
,
applicaton_chunks
[
i
].
host_ID
,
applicaton_chunks
[
i
].
core_ID
,
applicaton_chunks
[
i
].
startTime
,
applicaton_chunks
[
i
].
endTime
);
}
// ---------------------------- end of append -----------------------------
if
(
!
trace_append_flag
)
{
fprintf
(
fp
,
"
\n\n
"
);
fprintf
(
fp
,
"job counter = %d
\t
chunk counter = %d
\t
task counter = %d
\n
"
,
1
,
num_chunks
,
num_tasks
);
fprintf
(
fp
,
"Simulated execution time %7.6lf
\n
"
,
makespan
);
fprintf
(
fp
,
"Cost %7.6lf
\n
"
,
total_avail_cores
*
makespan
);
fprintf
(
fp
,
"---------------------------------------------------------------------------------
\n\n\n
"
);
}
fclose
(
fp
);
}
Event Timeline
Log In to Comment