1
1
/*****************************************************************************\
2
2
* block_allocator.c - Assorted functions for layout of bluegene blocks,
3
3
* wiring, mapping for smap, etc.
4
* $Id: block_allocator.c 17225 2009-04-10 19:25:52Z da $
4
* $Id: block_allocator.c 18612 2009-09-02 19:00:21Z da $
5
5
*****************************************************************************
6
6
* Copyright (C) 2004 The Regents of the University of California.
7
7
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
8
8
* Written by Dan Phung <phung4@llnl.gov>, Danny Auble <da@llnl.gov>
10
10
* This file is part of SLURM, a resource management program.
11
* For details, see <http://www.llnl.gov/linux/slurm/>.
11
* For details, see <https://computing.llnl.gov/linux/slurm/>.
12
* Please also read the included file: DISCLAIMER.
13
14
* SLURM is free software; you can redistribute it and/or modify it under
14
15
* the terms of the GNU General Public License as published by the Free
593
593
geo[Y] = DIM_SIZE[Y];
594
594
geo[Z] = DIM_SIZE[Z];
595
595
sz=ba_request->size;
597
ba_request->elongate_geos,
596
if((geo[X]*geo[Y]*geo[Z]) == ba_request->size)
598
ba_request->elongate_geos,
601
error("%d I was just trying to add a "
603
"while I am trying to request %d midplanes",
604
__LINE__, geo[X], geo[Y], geo[Z],
609
for(i=0; i<DIM_SIZE[X]; i++)
605
size3=ba_request->size;
607
612
for (i=0; i<BA_SYSTEM_DIMENSIONS; i++) {
608
613
total_sz *= DIM_SIZE[i];
613
size3=ba_request->size;
616
if(size3!=ba_request->size)
619
size2=ba_request->size;
620
size2 = ba_request->size;
622
622
for (i=picked; i<BA_SYSTEM_DIMENSIONS; i++) {
625
sz = size2%DIM_SIZE[i];
626
sz = size2 % DIM_SIZE[i];
627
628
geo[i] = DIM_SIZE[i];
628
629
size2 /= DIM_SIZE[i];
629
} else if (size2 > DIM_SIZE[i]){
630
for(i2=(DIM_SIZE[i]-1);i2>1;i2--) {
630
} else if (size2 > DIM_SIZE[i]) {
631
for(i2=(DIM_SIZE[i]-1); i2 > 1; i2--) {
631
632
/* go through each number to see if
632
633
the size is divisable by a smaller
634
635
good in the other dims. */
635
636
if (!(size2%i2) && !checked[i2]) {
1488
1507
grid[ba_node->coord[X]]
1489
1508
[ba_node->coord[Y]]
1490
1509
[ba_node->coord[Z]];
1491
1511
if(ba_node->used && curr_ba_node->used) {
1492
debug3("I have already been to "
1494
alpha_num[ba_node->coord[X]],
1495
alpha_num[ba_node->coord[Y]],
1496
alpha_num[ba_node->coord[Z]]);
1512
/* Only error if the midplane isn't already
1513
* marked down or in a error state outside of
1514
* the bluegene block.
1516
uint16_t base_state, node_flags;
1517
base_state = curr_ba_node->state & NODE_STATE_BASE;
1518
node_flags = curr_ba_node->state & NODE_STATE_FLAGS;
1519
if (!(node_flags & (NODE_STATE_DRAIN | NODE_STATE_FAIL))
1520
&& (base_state != NODE_STATE_DOWN)) {
1521
debug4("I have already been to "
1522
"this node %c%c%c %s",
1523
alpha_num[ba_node->coord[X]],
1524
alpha_num[ba_node->coord[Y]],
1525
alpha_num[ba_node->coord[Z]],
1526
node_state_string(curr_ba_node->state));
1501
1532
if(ba_node->used)
2173
2204
check[4] = '\0';
2208
if((check[1] < '0' || check[1] > '9')
2209
|| (check[2] < '0' || check[2] > '9')
2210
|| (check[3] < '0' || check[3] > '9')) {
2211
error("%s is not a valid Rack-Midplane (i.e. R000)", bp_id);
2177
2216
if(check[3] != '-') {
2179
2218
check = xstrdup_printf("R%c%c-M%c",
2180
2219
bp_id[1], bp_id[2], bp_id[3]);
2222
if((check[1] < '0' || check[1] > '9')
2223
|| (check[2] < '0' || check[2] > '9')
2224
|| (check[5] < '0' || check[5] > '9')) {
2225
error("%s is not a valid Rack-Midplane (i.e. R00-M0)", bp_id);
2184
2230
itr = list_iterator_create(bp_map_list);
2185
2231
while ((bp_map = list_next(itr)))
2186
2232
if (!strcasecmp(bp_map->bp_id, check))
2187
2233
break; /* we found it */
2188
2234
list_iterator_destroy(itr);
2192
2239
if(bp_map != NULL)
3175
3233
next_node = &ba_system_ptr->
3176
3234
grid[node_tar[X]][node_tar[Y]][node_tar[Z]];
3177
3235
dim_next_switch = &next_node->axis_switch[i2];
3178
debug3("%c%c%c port 5",
3236
debug4("%c%c%c port 5",
3179
3237
alpha_num[next_node->coord[X]],
3180
3238
alpha_num[next_node->coord[Y]],
3181
3239
alpha_num[next_node->coord[Z]]);
3183
3241
if(dim_next_switch->int_wire[5].used) {
3184
debug2("returning here 2");
3242
debug3("returning here 2");
3187
debug4("%d %d %d %d",i2, node_tar[i2],
3245
debug5("%d %d %d %d",i2, node_tar[i2],
3188
3246
first[i2], geometry[i2]);
3190
3248
/* Here we need to see where we are in
3982
4039
/* set up split x */
3983
4040
if(DIM_SIZE[X] == 1) {
4041
} else if(DIM_SIZE[X] == 4) {
4045
/* 0 and 3rd Node */
4050
target = &ba_system_ptr->grid[0]
4054
_switch_config(source, target, dim, 4, 3);
4058
target = &ba_system_ptr->grid[3]
4061
/* 4->3 of 3rd and back */
4062
_switch_config(source, target, dim, 4, 3);
4063
_switch_config(source, target, dim, 3, 4);
4066
fatal("got %d for a count on a %d X-dim system",
4067
count, DIM_SIZE[X]);
3984
4070
} else if(DIM_SIZE[X] == 5) {
3985
4071
/* 4 X dim fixes for wires */
3986
4072
switch(count) {
4076
4162
count, DIM_SIZE[X]);
4165
} else if(DIM_SIZE[X] == 9) {
4169
/* 0 and 4th Node */
4174
/*already handled below */
4178
target = &ba_system_ptr->grid[7]
4181
/* 4->3 of 7th and back */
4182
_switch_config(source, target, dim, 4, 3);
4183
_switch_config(target, source, dim, 4, 3);
4187
target = &ba_system_ptr->grid[6]
4190
/* 4->3 of 6th and back */
4191
_switch_config(source, target, dim, 4, 3);
4192
_switch_config(target, source, dim, 4, 3);
4196
target = &ba_system_ptr->grid[5]
4199
/* 4->3 of 5th and back */
4200
_switch_config(source, target, dim, 4, 3);
4201
_switch_config(target, source, dim, 4, 3);
4205
target = &ba_system_ptr->grid[0]
4209
_switch_config(source, target, dim, 4, 3);
4212
fatal("got %d for a count on a %d X-dim system",
4213
count, DIM_SIZE[X]);
4079
4216
} else if(DIM_SIZE[X] == 13) {
4080
4217
int temp_num = 0;
4355
4492
next_switch = &next_node->axis_switch[X];
4357
4494
if((conn_type == SELECT_MESH) && (found == (x_size))) {
4358
debug2("Algo(%d) we found the end of the mesh",
4495
debug3("Algo(%d) we found the end of the mesh",
4362
debug3("Algo(%d) Broke = %d Found = %d x_size = %d",
4499
debug4("Algo(%d) Broke = %d Found = %d x_size = %d",
4363
4500
algo, broke, found, x_size);
4365
4502
if(broke && (found == x_size)) {
4366
4503
goto found_path;
4367
4504
} else if(found == x_size) {
4368
debug2("Algo(%d) finishing the torus!", algo);
4505
debug3("Algo(%d) finishing the torus!", algo);
4370
4507
if(deny_pass && (*deny_pass & PASS_DENY_X)) {
4371
4508
info("we don't allow passthroughs 1");
4901
5043
curr_switch->ext_wire[0].node_tar[Z])) {
5049
ba_node_t *next_node = NULL;
4905
5050
port_tar = curr_switch->
4906
5051
ext_wire[ports_to_try[i]].port_tar;
4907
5052
node_tar = curr_switch->
4908
5053
ext_wire[ports_to_try[i]].node_tar;
5055
/* Check to see if I am going to a place I have
5056
already been before, because even
5057
though we may be able to do this
5058
electrically this doesn't mean the
5059
under lying infrastructure will
5061
itr = list_iterator_create(results);
5062
while((next_node = list_next(itr))) {
5063
debug4("finishing_torus: "
5064
"looking at %c%c%c and %c%c%c",
5065
alpha_num[next_node->coord[X]],
5066
alpha_num[next_node->coord[Y]],
5067
alpha_num[next_node->coord[Z]],
5068
alpha_num[node_tar[X]],
5069
alpha_num[node_tar[Y]],
5070
alpha_num[node_tar[Z]]);
5071
if((node_tar[X] == next_node->coord[X])
5073
== next_node->coord[Y])
5075
== next_node->coord[Z])) {
5079
list_iterator_destroy(itr);
5081
debug3("finishing_torus: "
5082
"Can't finish torus with "
5083
"%c%c%c we already were there.",
5084
alpha_num[next_node->coord[X]],
5085
alpha_num[next_node->coord[Y]],
5086
alpha_num[next_node->coord[Z]]);
4910
5090
next_switch = &ba_system_ptr->grid[node_tar[X]]
5016
5196
int *geo_ptr = (int *)object;
5017
5197
xfree(geo_ptr);
5023
int main(int argc, char** argv)
5025
ba_request_t *request = (ba_request_t*) xmalloc(sizeof(ba_request_t));
5026
log_options_t log_opts = LOG_OPTS_INITIALIZER;
5027
int debug_level = 6;
5028
node_info_msg_t *new_node_ptr = NULL;
5033
log_opts.stderr_level = debug_level;
5034
log_opts.logfile_level = debug_level;
5035
log_opts.syslog_level = debug_level;
5037
log_alter(log_opts, LOG_DAEMON,
5043
while (slurm_load_node((time_t) NULL, &new_node_ptr, SHOW_ALL)) {
5045
sleep(10); /* keep trying to reconnect */
5048
ba_init(new_node_ptr);
5051
results = list_create(NULL);
5052
request->geometry[0] = 1;
5053
request->geometry[1] = 1;
5054
request->geometry[2] = 1;
5055
request->start[0] = 6;
5056
request->start[1] = 3;
5057
request->start[2] = 2;
5058
request->start_req = 1;
5059
// request->size = 1;
5060
request->rotate = 0;
5061
request->elongate = 0;
5062
request->conn_type = SELECT_TORUS;
5063
new_ba_request(request);
5064
print_ba_request(request);
5065
if(!allocate_block(request, results)) {
5066
debug("couldn't allocate %c%c%c",
5067
request->geometry[0],
5068
request->geometry[1],
5069
request->geometry[2]);
5071
list_destroy(results);
5073
results = list_create(NULL);
5074
request->geometry[0] = 2;
5075
request->geometry[1] = 4;
5076
request->geometry[2] = 1;
5077
request->start[0] = 3;
5078
request->start[1] = 0;
5079
request->start[2] = 2;
5080
request->start_req = 1;
5081
// request->size = 16;
5082
request->rotate = 0;
5083
request->elongate = 0;
5084
request->conn_type = SELECT_TORUS;
5085
new_ba_request(request);
5086
print_ba_request(request);
5087
if(!allocate_block(request, results)) {
5088
debug("couldn't allocate %c%c%c",
5089
alpha_num[request->geometry[0]],
5090
alpha_num[request->geometry[1]],
5091
alpha_num[request->geometry[2]]);
5093
list_destroy(results);
5095
results = list_create(NULL);
5096
request->geometry[0] = 2;
5097
request->geometry[1] = 1;
5098
request->geometry[2] = 4;
5099
request->start[0] = 5;
5100
request->start[1] = 2;
5101
request->start[2] = 0;
5102
request->start_req = 1;
5103
request->rotate = 0;
5104
request->elongate = 0;
5105
request->conn_type = SELECT_TORUS;
5106
new_ba_request(request);
5107
print_ba_request(request);
5108
if(!allocate_block(request, results)) {
5109
debug("couldn't allocate %c%c%c",
5110
alpha_num[request->geometry[0]],
5111
alpha_num[request->geometry[1]],
5112
alpha_num[request->geometry[2]]);
5114
list_destroy(results);
5116
/* results = list_create(NULL); */
5117
/* request->geometry[0] = 4; */
5118
/* request->geometry[1] = 4; */
5119
/* request->geometry[2] = 4; */
5120
/* //request->size = 2; */
5121
/* request->conn_type = SELECT_TORUS; */
5122
/* new_ba_request(request); */
5123
/* print_ba_request(request); */
5124
/* if(!allocate_block(request, results)) { */
5125
/* printf("couldn't allocate %c%c%c\n", */
5126
/* request->geometry[0], */
5127
/* request->geometry[1], */
5128
/* request->geometry[2]); */
5131
/* results = list_create(NULL); */
5132
/* request->geometry[0] = 1; */
5133
/* request->geometry[1] = 4; */
5134
/* request->geometry[2] = 4; */
5135
/* //request->size = 2; */
5136
/* request->conn_type = SELECT_TORUS; */
5137
/* new_ba_request(request); */
5138
/* print_ba_request(request); */
5139
/* if(!allocate_block(request, results)) { */
5140
/* printf("couldn't allocate %c%c%c\n", */
5141
/* request->geometry[0], */
5142
/* request->geometry[1], */
5143
/* request->geometry[2]); */
5151
int endx=DIM_SIZE[X];
5152
int endy=1;//DIM_SIZE[Y];
5153
int endz=1;//DIM_SIZE[Z];
5155
for(x=startx;x<endx;x++) {
5156
for(y=starty;y<endy;y++) {
5157
for(z=startz;z<endz;z++) {
5158
ba_node_t *curr_node =
5159
&(ba_system_ptr->grid[x][y][z]);
5160
info("Node %c%c%c Used = %d Letter = %c",
5161
alpha_num[x],alpha_num[y],alpha_num[z],
5164
for(dim=0;dim<1;dim++) {
5167
&curr_node->axis_switch[dim];
5168
for(j=0;j<NUM_PORTS_PER_NODE;j++)
5169
info("\t%d -> %d -> %c%c%c %d "
5171
j, wire->int_wire[j].
5173
alpha_num[wire->ext_wire[
5177
alpha_num[wire->ext_wire[
5181
alpha_num[wire->ext_wire[
5189
wire->int_wire[j].used);
5194
/* list_destroy(results); */
5198
/* delete_ba_request(request); */