{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eBIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee\u0027s research advisor, Jack Swigert, has asked her to benchmark the new system.\u003c/p\u003e\n\u003cp\u003e``Since the Apollo is a distributed shared memory machine, memory access and communication times are not uniform,\u0027\u0027 Valentine told Swigert. ``Communication is fast between processors that share the same memory subsystem, but it is slower between processors that are not on the same subsystem. Communication between the Apollo and machines in our lab is slower yet.\u0027\u0027\u003c/p\u003e\n\u003cp\u003e``How is Apollo\u0027s port of the Message Passing Interface (MPI) working out?\u0027\u0027 Swigert asked.\u003c/p\u003e\n\u003cp\u003e``Not so well,\u0027\u0027 Valentine replied. ``To do a broadcast of a message from one processor to all the other \u003ci\u003en\u003c/i\u003e-1 processors, they just do a sequence of \u003ci\u003en\u003c/i\u003e-1 sends. That really serializes things and kills the performance.\u0027\u0027\u003c/p\u003e\n\u003cp\u003e``Is there anything you can do to fix that?\u0027\u0027\u003c/p\u003e\n\u003cp\u003e``Yes,\u0027\u0027 smiled Valentine. ``There is. Once the first processor has sent the message to another, those two can then send messages to two other hosts at the same time. Then there will be four hosts that can send, and so on.\u0027\u0027\u003c/p\u003e\n\u003cp\u003e``Ah, so you can do the broadcast as a binary tree!\u0027\u0027\u003c/p\u003e\n\u003cp\u003e``Not really a binary tree -- there are some particular features of our network that we should exploit. The interface cards we have allow each processor to simultaneously send messages to any number of the other processors connected to it. However, the messages don\u0027t necessarily arrive at the destinations at the same time -- there is a communication cost involved. In general, we need to take into account the communication costs for each link in our network topologies and plan accordingly to minimize the total time required to do a broadcast.\u0027\u0027\u003c/p\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003ch2\u003e\u003cfont color\u003d\"#0070e8\"\u003e\u003ca name\u003d\"SECTION0001001000000000000000\"\u003eInput\u003c/a\u003e\u003c/font\u003e\u003c/h2\u003e\n\u003cp\u003eThe input will describe the topology of a network connecting \u003ci\u003en\u003c/i\u003e processors. The first line of the input will be \u003ci\u003en\u003c/i\u003e, the number of processors, such that \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline43\" height\u003d\"25\" src\u003d\"CDN_BASE_URL/2b7a35c5fe9b5f48bb90d45258750fe9?v\u003d1672679707\" width\u003d\"90\"\u003e .\u003c/p\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cp\u003eThe rest of the input defines an adjacency matrix, \u003ci\u003eA\u003c/i\u003e. The adjacency matrix is square and of size \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline47\" height\u003d\"18\" src\u003d\"CDN_BASE_URL/de83f27394fb93b8241edb2944baf6a6?v\u003d1672679707\" width\u003d\"41\"\u003e . Each of its entries will be either an integer or the character \u003ctt\u003ex\u003c/tt\u003e. The value of \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline49\" height\u003d\"26\" src\u003d\"CDN_BASE_URL/49c1d03e5b29d9de01720f907155f1b2?v\u003d1672679707\" width\u003d\"36\"\u003e indicates the expense of sending a message directly from node \u003ci\u003ei\u003c/i\u003e to node \u003ci\u003ej\u003c/i\u003e. A value of \u003ctt\u003ex\u003c/tt\u003e for \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline49\" height\u003d\"26\" src\u003d\"CDN_BASE_URL/49c1d03e5b29d9de01720f907155f1b2?v\u003d1672679707\" width\u003d\"36\"\u003e indicates that a message cannot be sent directly from node \u003ci\u003ei\u003c/i\u003e to node \u003ci\u003ej\u003c/i\u003e.\u003c/p\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cp\u003eNote that for a node to send a message to itself does not require network communication, so \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline61\" height\u003d\"26\" src\u003d\"CDN_BASE_URL/71946792a4580a439eda026dbc6cf2b1?v\u003d1672679707\" width\u003d\"68\"\u003e for \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline63\" height\u003d\"25\" src\u003d\"CDN_BASE_URL/e49a92e274b13a5bcd89d1517f437017?v\u003d1672679707\" width\u003d\"70\"\u003e . Also, you may assume that the network is undirected (messages can go in either direction with equal overhead), so that \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline65\" height\u003d\"26\" src\u003d\"CDN_BASE_URL/fbae26eb929f83bdcc41d7f39be5ac9b?v\u003d1672679707\" width\u003d\"98\"\u003e . Thus only the entries on the (strictly) lower triangular portion of \u003ci\u003eA\u003c/i\u003e will be supplied.\u003c/p\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cp\u003eThe input to your program will be the lower triangular section of \u003ci\u003eA\u003c/i\u003e. That is, the second line of input will contain one entry, \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline71\" height\u003d\"26\" src\u003d\"CDN_BASE_URL/e8e1fd8f8d6d0e1ef1f930254f0e603a?v\u003d1672679707\" width\u003d\"39\"\u003e . The next line will contain two entries, \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline73\" height\u003d\"26\" src\u003d\"CDN_BASE_URL/2d5fe70213f2c781ea8d63a1d82f04de?v\u003d1672679707\" width\u003d\"39\"\u003e and \u003cimg align\u003d\"middle\" alt\u003d\"tex2html_wrap_inline75\" height\u003d\"26\" src\u003d\"CDN_BASE_URL/8b9dfe5f6d7b29a377374ab31a81f682?v\u003d1672679707\" width\u003d\"39\"\u003e , and so on.\u003c/p\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003ch2\u003e\u003cfont color\u003d\"#0070e8\"\u003e\u003ca name\u003d\"SECTION0001002000000000000000\"\u003eOutput\u003c/a\u003e\u003c/font\u003e\u003c/h2\u003e\n\u003cp\u003eYour program should output the minimum communication time required to broadcast a message from the first processor to all the other processors.\u003c/p\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003ch2\u003e\u003cfont color\u003d\"#0070e8\"\u003e\u003ca name\u003d\"SECTION0001003000000000000000\"\u003eSample Input\u003c/a\u003e\u003c/font\u003e\u003c/h2\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cpre\u003e5\n50\n30 5\n100 20 50\n10 x x 10\u003c/pre\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003ch2\u003e\u003cfont color\u003d\"#0070e8\"\u003e\u003ca name\u003d\"SECTION0001004000000000000000\"\u003eSample Output\u003c/a\u003e\u003c/font\u003e\u003c/h2\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cpre\u003e35\u003c/pre\u003e\n\u003cp\u003e\u003c/p\u003e"}}]}