Chunking metabot design notes (”reverse engineered” the metabot to figure out what can be assigned to MC)
Overview of metabot’s execution steps:
What can be pulled out from metabot to metabot controller:
Metabot can basically have generic functions to read and write files, get params from MC, be launched by MC, should it tell MC when it has completed?
Nitty-gritty implementation details of metabot:
By function:
1. main.c:
usage: "metabot run# #of_nodes metabot_rank"
opens a fixed directory, defined by global DATADIR
if directory is opened:
char buffer 'data' is allocated with size SIZE (global, defined)
calls dir_reader with dir descriptor dp
2. dir_reader(DIR *dp):
reads directory in line 195: dirp = readdir(dp);
( struct dirent *dirp )
condition to end the program in lines 197-***:
while ((dirp != NULL) && !done), done is set in
check_for_done(dirp->d_name)
if dirp isn't null after it reads another entry, it sleeps and
waits
for a new file to appear that may be the last file, whose
name indicates
falls out of loop once last written file is found:
starts timer:
rewinds pointer to beginning of directory
countFiles(dirp, dp); counts # of files
[Why are the above 2 instructions inside of the timer??? dumb]
loops while not done: (finally meat and potatos)
rewind pointer again
[currTimeStep: global int, initialized to 0,incremented by 50]
while dirp = readdir(dp) != NULL:
if parse_file_name(dirp->d_name) is true:
end timer
3. check_for_done(char *filename):
parses file name to check the extension; if ext = "done", return 1,
else 0
4. parse_file_name(char *filename):
parses file name, checks for correctness wrt type of file,
then checks 'tmp'
(field to see if it equals currTimeStep;
if yes, increment nodecnt and return 1, else return 0)