Skip to content
Snippets Groups Projects
Commit 7233630d authored by phung4's avatar phung4
Browse files

fixed bug with no side affect of allocations

parent a4f8206c
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ AUTOMAKE_OPTIONS = foreign ...@@ -5,6 +5,7 @@ AUTOMAKE_OPTIONS = foreign
INCLUDES = -I$(top_srcdir) INCLUDES = -I$(top_srcdir)
# to build the executable
bin_PROGRAMS = partition_allocator bin_PROGRAMS = partition_allocator
partition_allocator_SOURCES = partition_allocator.c partition_allocator.h \ partition_allocator_SOURCES = partition_allocator.c partition_allocator.h \
...@@ -16,24 +17,22 @@ partition_allocator_LDADD = \ ...@@ -16,24 +17,22 @@ partition_allocator_LDADD = \
partition_allocator_LDFLAGS = -export-dynamic -lm $(CMD_LDFLAGS) partition_allocator_LDFLAGS = -export-dynamic -lm $(CMD_LDFLAGS)
# making a .la
# lib_LTLIBRARIES = libpartition_allocator.la
# libpartition_allocator_la_SOURCES = \
# partition_allocator.c partition_allocator.h\
# graph_solver.c graph_solver.h\
# graph_structs.c graph_structs.h
#making a .la # libpartition_allocator_la_LIBADD = $(top_builddir)/src/common/libcommon.la -lpthread
lib_LTLIBRARIES = libpartition_allocator.la
libpartition_allocator_la_SOURCES = \ # libpartition_allocator_la_LDFLAGS = \
partition_allocator.c partition_allocator.h\ # $(LIB_LDFLAGS) -lm
graph_solver.c graph_solver.h\
graph_structs.c graph_structs.h
libpartition_allocator_la_LIBADD = $(top_builddir)/src/common/libcommon.la -lpthread # libpartition_allocator_la_DEPENDENCIES = \
# $(top_builddir)/src/common/libcommon.la
libpartition_allocator_la_LDFLAGS = \ ####
$(LIB_LDFLAGS) -lm
libpartition_allocator_la_DEPENDENCIES = \
$(top_builddir)/src/common/libcommon.la
#####
#force: #force:
#$(convenience_libs) : force #$(convenience_libs) : force
......
...@@ -375,7 +375,8 @@ int find_all_tori(List conf_result_list) ...@@ -375,7 +375,8 @@ int find_all_tori(List conf_result_list)
printf("ALL DONE\n"); printf("ALL DONE\n");
*/ */
_print_results(conf_result_list); // 999
// _print_results(conf_result_list);
return SUCCESS; return SUCCESS;
} }
...@@ -632,9 +633,7 @@ void _insert_results(List conf_result_list, List result_partitions, List current ...@@ -632,9 +633,7 @@ void _insert_results(List conf_result_list, List result_partitions, List current
} }
list_iterator_destroy(itr); list_iterator_destroy(itr);
// if ((has_large_part && found_torus && p1_all_toroidal) || part_size == list_count(global_sys->node_list)){ if (has_large_part && found_torus && p1_all_toroidal){
if ((has_large_part && p1_all_toroidal) || part_size == list_count(global_sys->node_list)){
// if (has_large_part && found_torus && p1_all_toroidal){
conf_data_t* conf_data; conf_data_t* conf_data;
conf_result_t* conf_result; conf_result_t* conf_result;
port_conf_t* port_conf, *port_conf_copy; port_conf_t* port_conf, *port_conf_copy;
......
...@@ -43,7 +43,6 @@ int DIM_SIZE[PA_SYSTEM_DIMENSIONS] = {8,4,4}; ...@@ -43,7 +43,6 @@ int DIM_SIZE[PA_SYSTEM_DIMENSIONS] = {8,4,4};
List* _conf_result_list; List* _conf_result_list;
bool _initialized = false; bool _initialized = false;
/** some internal structures used in the partition allocator alone /** some internal structures used in the partition allocator alone
* *
* the partition virtual system is a linked list where each node has a * the partition virtual system is a linked list where each node has a
...@@ -1219,7 +1218,6 @@ void pa_init() ...@@ -1219,7 +1218,6 @@ void pa_init()
{ {
int i; int i;
List switch_config_list; List switch_config_list;
#ifdef DEBUG_PA #ifdef DEBUG_PA
printf("pa_init()\n"); printf("pa_init()\n");
...@@ -1239,13 +1237,17 @@ void pa_init() ...@@ -1239,13 +1237,17 @@ void pa_init()
} }
/* see if we can load in the filenames from the env */ /* see if we can load in the filenames from the env */
filenames[X] = "Y_dim_torus.conf"; filenames[X] = "X_alt_dim_torus.conf";
filenames[Y] = "Y_dim_torus.conf"; filenames[Y] = "Y_dim_torus.conf";
filenames[Z] = "Z_dim_torus.conf"; filenames[Z] = "Z_dim_torus.conf";
/* create the X configuration (8 nodes) */ /* create the X configuration (8 nodes) */
if (filenames[X]){ if (filenames[X]){
time_t start, end;
time(&start);
_load_part_config(filenames[X], _conf_result_list[X]); _load_part_config(filenames[X], _conf_result_list[X]);
time(&end);
error("loading file time: %ld\n", (end-start));
} else { } else {
switch_config_list = list_create(delete_gen); switch_config_list = list_create(delete_gen);
create_config_8_1d(switch_config_list); create_config_8_1d(switch_config_list);
...@@ -1335,7 +1337,8 @@ void set_node_down(int c[PA_SYSTEM_DIMENSIONS]) ...@@ -1335,7 +1337,8 @@ void set_node_down(int c[PA_SYSTEM_DIMENSIONS])
#endif #endif
/* first we make a copy of the current system */ /* first we make a copy of the current system */
_backup_pa_system(); // 999
//_backup_pa_system();
/* basically set the node as NULL */ /* basically set the node as NULL */
_delete_pa_node(&(_pa_system[c[0]][c[1]][c[2]])); _delete_pa_node(&(_pa_system[c[0]][c[1]][c[2]]));
...@@ -1367,7 +1370,8 @@ int allocate_part(pa_request_t* pa_request, List* results) ...@@ -1367,7 +1370,8 @@ int allocate_part(pa_request_t* pa_request, List* results)
print_pa_request(pa_request); print_pa_request(pa_request);
#endif #endif
_backup_pa_system(); // 999
// _backup_pa_system();
_find_first_match(pa_request, results); _find_first_match(pa_request, results);
return 1; return 1;
} }
...@@ -1401,6 +1405,7 @@ int main(int argc, char** argv) ...@@ -1401,6 +1405,7 @@ int main(int argc, char** argv)
bool force_contig = true; bool force_contig = true;
List results; List results;
pa_request_t* request; pa_request_t* request;
time_t start, end;
if (argc == 4){ if (argc == 4){
int i; int i;
...@@ -1422,7 +1427,11 @@ int main(int argc, char** argv) ...@@ -1422,7 +1427,11 @@ int main(int argc, char** argv)
exit(0); exit(0);
} }
time(&start);
pa_init(); pa_init();
time(&end);
error("init: %ld\n", (end-start));
/* /*
int dead_node1[3] = {0,0,0}; int dead_node1[3] = {0,0,0};
int dead_node2[3] = {1,0,0}; int dead_node2[3] = {1,0,0};
...@@ -1431,17 +1440,36 @@ int main(int argc, char** argv) ...@@ -1431,17 +1440,36 @@ int main(int argc, char** argv)
printf("done setting node down\n"); printf("done setting node down\n");
*/ */
time(&start);
if (allocate_part(request, &results)){ if (allocate_part(request, &results)){
ListIterator itr;
pa_node_t* result;
printf("allocation succeeded\n"); printf("allocation succeeded\n");
itr = list_iterator_create(results);
printf("results: \n");
while((result = (pa_node_t*) list_next(itr))){
printf("%d%d%d ",
result->coord[0],
result->coord[1],
result->coord[2]);
}
printf("\n");
// _print_results(results); // _print_results(results);
list_destroy(results); list_destroy(results);
} else { } else {
printf("request failed\n"); printf("request failed\n");
} }
time(&end);
error("allocate: %ld\n", (end-start));
delete_pa_request(request); time(&start);
pa_fini(); pa_fini();
time(&end);
error("fini: %ld\n", (end-start));
return 0; return 0;
} }
#!/bin/bash #!/bin/bash
export X_DIM_CONF=Y_dim_torus.conf export X_DIM_CONF=X_dim_torus.conf
export Y_DIM_CONF=Y_dim_torus.conf export Y_DIM_CONF=Y_dim_torus.conf
export Z_DIM_CONF=Z_dim_torus.conf export Z_DIM_CONF=Z_dim_torus.conf
./partition_allocator ./partition_allocator 2 2 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment