ºìÁªLinuxÃÅ»§
Linux°ïÖú

¸ßÐÔÄÜµÄ Linux ¼¯Èº½éÉÜ

·¢²¼Ê±¼ä:2006-05-25 10:22:51À´Ô´:ºìÁª×÷Õß:koov
ÏÖÔÚ Linux ¼¯ÈºÔںܶàÁìÓò¶¼ÒѾ­±äµÃ·Ç³£Á÷ÐÐÁË¡£Ëæ׿¯Èº¼¼ÊõµÄ³öÏÖÒÔ¼°¿ª·ÅÔ´ÂëÈí¼þÈÕÒæµÃµ½²ÉÄÉ£¬ÏÖÔÚÖ»ÐèÒª´«Í³¸ßÐÔÄÜ»úÆ÷µÄºÜÉÙÒ»²¿·Ö³É±¾¾Í¿ÉÒÔ¹¹½¨Ò»Ì¨³¬¼¶¼ÆËã»úÁË¡£
¡¡¡¡ÕâÁ½ÆªÏµÁÐÎÄÕ¼òÒª½éÉܲÉÓà Linux ¼¯Èº¼¼ÊõµÄ¸ßÐÔÄܼÆË㣨HPC£©µÄ¸ÅÄչʾÈçºÎ¹¹½¨¼¯Èº²¢±àд²¢ÐгÌÐò¡£±¾ÎÄÊÇÁ½ÆªÏµÁÐÎÄÕÂÖеĵÚһƪ£¬ÌÖÂÛÁ˼¯ÈºµÄÀàÐÍ¡¢ÓÃ;¡¢HPC »ù´¡¡¢Linux ÔÚ HPC ÖеĽÇÉ«ÒÔ¼°¼¯Èº¼¼ÊõÈÕÒæÔö³¤µÄÔ­Òò¡£µÚ 2 ²¿·Ö½«½éÉܲ¢ÐÐËã·¨µÄ֪ʶ£¬²¢½éÉÜÈçºÎ±àд²¢ÐгÌÐò¡¢ÈçºÎ¹¹½¨¼¯ÈºÒÔ¼°ÈçºÎ½øÐлù×¼²âÊÔ¡£

HPC Ìåϵ¼Ü¹¹µÄÀàÐÍ

¡¡¡¡´ó²¿·Ö HPC ϵͳ¶¼Ê¹ÓÃÁ˲¢ÐÐ µÄ¸ÅÄî¡£ÓкܶàÈí¼þƽ̨¶¼ÊÇÃæÏò HPC µÄ£¬µ«ÊÇÊ×ÏÈÈÃÎÒÃÇÏÈÀ´Á˽âÒ»ÏÂÓ²¼þµÄ֪ʶ¡£

¡¡¡¡HPC Ó²¼þ¿ÉÒÔ·ÖΪ 3 Àࣺ

¶Ô³Æ¶à´¦ÀíÆ÷£¨SMP£©
ÏòÁ¿´¦ÀíÆ÷
¼¯Èº
¡¡¡¡¶Ô³Æ¶à´¦ÀíÆ÷£¨SMP£©

¡¡¡¡SMP ÊÇ HPC ²ÉÓõÄÌåϵ¼Ü¹¹Ö®Ò»£¬ÆäÖÐÓжà¸ö´¦ÀíÆ÷»á¹²ÏíÄÚ´æ¡££¨ÔÚ¼¯ÈºÖУ¬ÕâÒ²³ÆΪ ´ó¹æÄ£²¢Ðд¦ÀíÆ÷£¨massively parallel processor£¬MPP£©£¬ËüÃDz¢²»ÐèÒª¹²ÏíÄڴ棻ÉÔºóÎÒÃǽ«¸üÏêϸ½éÉÜÕâ·½ÃæµÄÄÚÈÝ¡££©Óë MPP Ïà±È£¬SMP ͨ³£³É±¾¸ü¸ß£¬¶øÇÒ¿ÉÉìËõÐԽϲ

¡¡¡¡ÏòÁ¿´¦ÀíÆ÷

¡¡¡¡¹ËÃû˼Ò壬ÔÚÏòÁ¿´¦ÀíÆ÷ÖУ¬CPU ±»ÓÅ»¯ÒÔ±ãºÜºÃµØ´¦ÀíÏòÁ¿Êý×éµÄÔËËã¡£ÏòÁ¿´¦ÀíÆ÷ϵͳµÄÐÔÄܸܺߣ¬ÔÚ 20 ÊÀ¼Í 80 Äê´úµ½ 90 Äê´úÔçÆÚÒ»¶ÈÔÚ HPC Ìåϵ¼Ü¹¹ÖÐÕ¼ÓÐͳÖεØ룬µ«ÊÇ×î½ü¼¸ÄêÒÔÀ´£¬¼¯Èº±äµÃ¸ü¼ÓÁ÷ÐÐÁË¡£

¡¡¡¡¼¯Èº

¡¡¡¡¼¯ÈºÊÇ×î½ü¼¸ÄêÖÐ×îΪÖ÷ÒªµÄÒ»ÖÖ HPC Ó²¼þ£º¼¯Èº£¨cluster£© ¾ÍÊÇÒ»×é MPP µÄ¼¯ºÏ¡£¼¯ÈºÖеĴ¦ÀíÆ÷ͨ³£±»³ÆΪ ½Úµã£¬Ëü¾ßÓÐ×Ô¼ºµÄ CPU¡¢ÄÚ´æ¡¢²Ù×÷ϵͳ¡¢I/O ×Óϵͳ£¬²¢ÇÒ¿ÉÒÔÓëÆäËû½Úµã½øÐÐͨÐÅ¡£Ä¿Ç°ÓкܶàµØ·½¶¼Ê¹Óó£¼ûµÄ¹¤×÷Õ¾ÔËÐÐ Linux ºÍÆäËû¿ª·ÅÔ´ÂëÈí¼þÀ´³äµ±¼¯ÈºÖеĽڵ㡣

¡¡¡¡½ÓÏÂÀ´Äú½«¿´µ½ÕâЩ HPC Ó²¼þÖ®¼äµÄÇø±ð£¬µ«ÊÇÊ×ÏÈÈÃÎÒÃÇ´Ó¼¯Èº¿ªÊ¼¡£

¡¡¡¡¼¯Èº¶¨Òå

¡¡¡¡ÊõÓï¡°¼¯Èº£¨cluster£©¡±ÔÚ²»Í¬µÄµØ·½¿ÉÄÜ»áÒâζ×Ų»Í¬µÄÒâÒå¡£±¾ÎÄÖصã½éÉÜÒÔÏÂÈýÖÖÀàÐ͵ļ¯Èº£º

¹ÊÕÏǨÒƼ¯Èº
¸ºÔؾùºâ¼¯Èº
¸ßÐÔÄܼ¯Èº
¡¡¡¡¹ÊÕÏǨÒƼ¯Èº

¡¡¡¡×î¼òµ¥µÄ¹ÊÕÏǨÒƼ¯ÈºÓÐÁ½¸ö½Úµã£ºÒ»¸ö½ÚµãÊǻµÄ£¬ÁíÍâÒ»¸ö½ÚµãÊDZ¸Óõģ¬²»¹ýËü»áÒ»Ö±¶Ô»î¶¯½Úµã½øÐмàÊÓ¡£Ò»µ©»î¶¯½Úµã³öÏÖ¹ÊÕÏ£¬±¸Óýڵã¾Í»á½Ó¹ÜËüµÄ¹¤×÷£¬ÕâÑù¾ÍÄÜʹµÃ¹Ø¼üµÄϵͳÄܹ»³ÖÐø¹¤×÷¡£

¡¡¡¡¸ºÔؾùºâ¼¯Èº

¡¡¡¡¸ºÔؾùºâ¼¯ÈºÍ¨³£»áÔڷdz£·±Ã¦µÄ Web Õ¾µãÉϲÉÓã¬ËüÃÇÓжà¸ö½ÚµãÀ´³Ðµ£ÏàͬվµãµÄ¹¤×÷£¬Ã¿¸ö»ñÈ¡ Web Ò³ÃæµÄÐÂÇëÇ󶼱»¶¯Ì¬Â·Óɵ½Ò»¸ö¸ºÔؽϵ͵ĽڵãÉÏ¡£

¡¡¡¡¸ßÐÔÄܼ¯Èº

¡¡¡¡¸ßÐÔÄܼ¯ÈºÓÃÀ´ÔËÐÐÄÇЩ¶Ôʱ¼äÃô¸ÐµÄ²¢ÐгÌÐò£¬ËüÃǶÔÓÚ¿ÆѧÉçÇøÀ´Ëµ¾ßÓÐÌØÊâµÄÒâÒå¡£¸ßÐÔÄܼ¯ÈºÍ¨³£»áÔËÐÐһЩģÄâ³ÌÐòºÍÆäËû¶Ô CPU ·Ç³£Ãô¸ÐµÄ³ÌÐò£¬ÕâЩ³ÌÐòÔÚÆÕͨµÄÓ²¼þÉÏÔËÐÐÐèÒª»¨·Ñ´óÁ¿µÄʱ¼ä¡£

ͼ 1 ½âÊÍÁËÒ»¸ö»ù±¾µÄ¼¯Èº¡£±¾ÏµÁÐÎÄÕÂµÄµÚ 2 ²¿·Ö½«Õ¹Ê¾ÈçºÎ´´½¨ÕâÖÖ¼¯Èº£¬²¢ÎªÆä±àд³ÌÐò¡£


ͼ 1. »ù±¾µÄ¼¯Èº




¡¡¡¡Íø¸ñ¼ÆËã ÊÇÒ»¸ö¸üΪ¹ã·ºµÄÊõÓͨ³£ÓÃÀ´´ú±íÀûÓÃËÉñîºÏϵͳ֮¼äµÄЭ×÷À´ÊµÏÖÃæÏò·þÎñµÄ¼Ü¹¹£¨SOA£©¡£»ùÓÚ¼¯ÈºµÄ HPC ÊÇÍø¸ñ¼ÆËãµÄÒ»¸öÌØÀý£¬ÆäÖнڵãÖ®¼ä¶¼ÊǽôñîºÏµÄ¡£Íø¸ñ¼ÆËãµÄÒ»¸ö³É¹¦µÄ¡¢ÖÚËùÖÜÖªµÄÏîÄ¿ÊÇ SETI@home£¬¼´ËÑË÷ÍâÐÇÖǻ۵ÄÏîÄ¿£¬ËüʹÓÃÁË´óÔ¼Ò»°ÙÍǫ̀¼ÒÓà PC ÔÚÆÁ±£Ê±µÄ¿ÕÏÐ CPU ÖÜÆÚÀ´·ÖÎöÎÞÏßµçÌìÎÄÍûÔ¶¾µµÄÊý¾Ý¡£ÁíÍâÒ»¸öÀàËƵijɹ¦ÏîÄ¿ÊÇ Folding@Home ÏîÄ¿£¬ÓÃÀ´½øÐе°°×ÖʵÄÕÛµþ¼ÆËã¡£



¡¡¡¡¸ßÐÔÄܼ¯ÈºµÄ³£¼ûÓÃ;

¡¡¡¡¼¸ºõËùÓеIJúÒµ½ç¶¼ÐèÒª¿ìËٵĴ¦ÀíÄÜÁ¦¡£Ëæ×ÅÔ½À´Ô½±ãÒ˶øÇÒ¿ìËٵļÆËã»úµÄ³öÏÖ£¬¸ü¶à¹«Ë¾±íÏÖ³öÁ˶ÔÀûÓÃÕâЩ¼¼ÊõÓÅÊƵÄÐËȤ¡£ÈËÃǶÔÓÚ¼ÆËã´¦ÀíÄÜÁ¦µÄÐèÇóÊÇûÓÐÉÏÏ޵ģ»¾¡¹Ü´¦ÀíÄÜÁ¦ÔÚѸËÙÌá¸ß£¬µ«ÊÇÈËÃǵÄÐèÇóÈÔÈ»³¬³ö¼ÆËãÄÜÁ¦ËùÄÜÌṩµÄ·¶Î§¡£

¡¡¡¡ÉúÃü¿ÆѧÑо¿

¡¡¡¡µ°°×ÖÊ·Ö×ÓÊǷdz£¸´ÔÓµÄÁ´£¬Êµ¼ÊÉÏ¿ÉÒÔ±íʾΪÎÞÊý¸ö 3D ͼÐΡ£Êµ¼ÊÉÏ£¬ÔÚ½«µ°°×Öʷŵ½Ä³ÖÖÈÜÒºÖÐʱ£¬ËüÃÇ»á¿ìËÙ¡°ÕÛµþ¡±³É×Ô¼ºµÄ×ÔȻ״̬¡£²»ÕýÈ·µÄÕÛµþ»áµ¼Öºܶ༲²¡£¬ÀýÈç Alzheimer ²¡£»Òò´Ë£¬¶ÔÓÚµ°°×ÖÊÕÛµþµÄÑо¿·Ç³£ÖØÒª¡£

¡¡¡¡¿Æѧ¼ÒÊÔͼÀí½âµ°°×ÖÊÕÛµþµÄÒ»ÖÖ·½Ê½ÊÇͨ¹ýÔÚ¼ÆËã»úÉϽøÐÐÄ£Ä⡣ʵ¼ÊÉÏ£¬µ°°×ÖʵÄÕÛµþ½øÐе÷dz£Ñ¸ËÙ£¨¿ÉÄÜÖ»ÐèÒª 1 ΢Ã룩£¬²»¹ýÕâ¸ö¹ý³ÌÈ´·Ç³£¸´ÔÓ£¬Õâ¸öÄ£ÄâÔÚÆÕͨµÄ¼ÆËã»úÉÏ¿ÉÄÜÐèÒªÔËÐÐ 10 Äê¡£Õâ¸öÁìÓòÖ»²»¹ýÊÇÖî¶àÒµ½çÁìÓòÖкÜСµÄÒ»¸ö£¬µ«ÊÇËüÈ´ÐèÒª·Ç³£Ç¿´óµÄ¼ÆËãÄÜÁ¦¡£

¡¡¡¡Òµ½çÖÐÆäËûÁìÓò°üÀ¨ÖÆÒ©½¨Ä£¡¢ÐéÄâÍâ¿ÆÊÖÊõѵÁ·¡¢»·¾³ºÍÕï¶ÏÐéÄ⻯¡¢ÍêÕûµÄÒ½ÁƼǼÊý¾Ý¿âÒÔ¼°ÈËÀà»ùÒòÏîÄ¿¡£

¡¡¡¡Ê¯ÓͺÍÌìÈ»Æø¿±Ì½

¡¡¡¡Õð¶¯Í¼Öаüº¬Óдó½ºÍÑóµ×ÄÚ²¿ÌØÐÔµÄÏêϸÐÅÏ¢£¬¶ÔÕâЩÊý¾Ý½øÐзÖÎö¿ÉÒÔ°ïÖúÎÒÃÇ̽²âʯÓͺÍÆäËû×ÊÔ´¡£¼´±ã¶ÔÓÚÒ»¸öºÜСµÄÇøÓòÀ´Ëµ£¬Ò²ÓÐÊýÒÔ TB ¼ÆµÄÊý¾ÝÐèÒªÖع¹£»ÕâÖÖ·ÖÎöÏÔÈ»ÐèÒª´óÁ¿µÄ¼ÆËãÄÜÁ¦¡£Õâ¸öÁìÓò¶ÔÓÚ¼ÆËãÄÜÁ¦µÄÐèÇóÊÇÈç´ËÍúÊ¢£¬ÒÔÖÁÓÚ³¬¼¶¼ÆËã»ú´ó²¿·Ö¶¼ÊÇÔÚ´¦ÀíÕâÖÖ¹¤×÷¡£

¡¡¡¡ÆäËûµØÀíѧ·½ÃæµÄÑо¿Ò²ÐèÒªÀàËƵļÆËãÄÜÁ¦£¬ÀýÈçÓÃÀ´Ô¤²âµØÕðµÄϵͳ£¬ÓÃÓÚ°²È«ÐÔ¹¤×÷µÄ¶àÆ׶ÎÎÀÐdzÉÏñϵͳ¡£

¡¡¡¡Í¼Ïñ³ÊÏÖ

¡¡¡¡ÔÚ¹¤³ÌÁìÓò£¨ÀýÈ纽ÌìÒýÇæÉè¼Æ£©²Ù×ݸ߷ֱæÂʵĽ»»¥Ê½Í¼ÏñÔÚÐÔÄܺͿÉÉìËõÐÔ·½ÃæÀúÀ´¶¼ÊÇÒ»ÖÖÌôÕ½£¬ÒòΪÕâÒªÉæ¼°´óÁ¿µÄÊý¾Ý¡£»ùÓÚ¼¯ÈºµÄ¼¼ÊõÔÚÕâЩÁìÓòÒѾ­È¡µÃÁ˳ɹ¦£¬ËüÃǽ«äÖȾÆÁÄ»µÄÈÎÎñ·Ö¸îµ½¼¯ÈºÖеĸ÷¸ö½ÚµãÉÏ£¬ÔÚÿ¸ö½ÚµãÉ϶¼ÀûÓÃ×Ô¼ºµÄͼÐÎÓ²¼þÀ´³ÊÏÖ×Ô¼ºÕⲿ·ÖÆÁÄ»µÄͼÏñ£¬²¢½«ÕâЩÏñËØÐÅÏ¢´«Ë͵½Ò»¸öÖ÷½ÚµãÉÏ£¬Ö÷½Úµã¶ÔÕâЩÐÅÏ¢½øÐÐ×éºÏ£¬×îÖÕÐγÉÒ»¸öÍêÕûµÄͼÏñ¡£

¡¡¡¡Õâ¸öÁìÓòÖеÄÀý×ÓÄ¿Ç°²Å²»¹ýÊDZùɽһ½Ç£»¸ü¶àµÄÓ¦ÓóÌÐò£¬°üÀ¨ÌìÌåÎïÀíÄ£Äâ¡¢ÆøÏóÄ£Äâ¡¢¹¤³ÌÉè¼Æ¡¢½ðÈÚ½¨Ä£¡¢Ö¤È¯Ä£ÄâÒÔ¼°µçÓ°Ìؼ¼£¬¶¼ÐèÒª·á¸»µÄ¼ÆËã×ÊÔ´¡£¶ÔÓÚ¼ÆËãÄÜÁ¦Ô½À´Ô½¶àµÄÐèÇóÎÒÃǾͲ»ÔÙ½øÐнéÉÜÁË¡£


¡¡¡¡Linux ºÍ¼¯ÈºÈçºÎ¸Ä±äÁË HPC

¡¡¡¡ÔÚ»ùÓÚ¼¯ÈºµÄ¼ÆËã¼¼Êõ³öÏÖ֮ǰ£¬µäÐ͵ij¬¼¶¼ÆËã»ú¶¼ÊÇÏòÁ¿´¦ÀíÆ÷£¬ÓÉÓÚËüÃÇÈ«²¿²ÉÓÃרÓõÄÓ²¼þºÍÈí¼þ£¬Òò´Ë³É±¾Í¨³£»á³¬¹ýÒ»°ÙÍòÃÀÔª¡£

¡¡¡¡Ëæ×Å Linux ºÍÆäËûÃâ·ÑµÄ¼¯Èº¿ª·ÅÔ´ÂëÈí¼þ×é¼þµÄ³öÏֺͳ£ÓÃÓ²¼þ´¦ÀíÄÜÁ¦µÄÌá¸ß£¬ÕâÖÖÇé¿öÏÖÔÚÒѾ­·¢ÉúÁ˺ܴóµÄ±ä»¯¡£Äú¿ÉÒÔÀûÓÃÉÙÁ¿µÄ³É±¾À´¹¹½¨¹¦ÄÜÇ¿´óµÄ¼¯Èº£¬²¢Äܹ»¸ù¾ÝÐèÒªÀ´Ìí¼ÓÆäËû½Úµã¡£

¡¡¡¡GNU/Linux ²Ù×÷ϵͳ£¨Linux£©ÒѾ­ÔÚ¼¯ÈºÖеõ½ÁË´óÁ¿µÄ²ÉÓá£Linux ¿ÉÒÔÔںܶàÓ²¼þÉÏÔËÐУ¬²¢ÇÒ¾ßÓиßÖÊÁ¿µÄ±àÒëÆ÷ºÍÆäËûÈí¼þ£¬ÀýÈç²¢ÐÐÎļþϵͳºÍ MPI ʵÏÖÔÚ Linux É϶¼ÊÇÃâ·ÑµÄ¡£²ÉÓà Linux£¬Óû§»¹¿ÉÒÔÕë¶Ô×Ô¼ºµÄÈÎÎñ¸ºÔضÔÄں˽øÐж¨ÖÆ¡£Linux Êǹ¹½¨ HPC ¼¯ÈºµÄÒ»¸ö·Ç³£ºÃµÄƽ̨¡£

¡¡¡¡Àí½âÓ²¼þ£ºÏòÁ¿»úÓ뼯Ⱥ

¡¡¡¡ÒªÀí½â HPC Ó²¼þ£¬¶ÔÏòÁ¿¼ÆËãºÍ¼¯Èº¼ÆËã½øÐÐһϱȽÏÊǷdz£ÓÐÓõġ£¶þÕßÊÇ»¥ÏྺÕùµÄ¼¼Êõ£¨µØÇòÄ£ÄâÆ÷ ÊÇһ̨ÏòÁ¿³¬¼¶¼ÆËã»ú£¬Ä¿Ç°ÈÔÈ»ÊÇ×î¿ìµÄ 10 ̨»úÆ÷Ö®Ò»£©¡£

¡¡¡¡´Ó¸ù±¾ÉÏÀ´½²£¬ÏòÁ¿´¦ÀíÆ÷ºÍ±êÁ¿´¦ÀíÆ÷¶¼ÊÇ»ùÓÚʱÖÓÖÜÆÚÀ´Ö´ÐÐÖ¸ÁîµÄ£»Ê¹ËüÃDzúÉúÇø±ðµÄÊÇÏòÁ¿´¦ÀíÆ÷²¢Ðд¦ÀíÓëÏòÁ¿ÓйصļÆËãµÄÄÜÁ¦£¨ÀýÈç¾ØÕó³Ë·¨£©£¬ÕâÔÚ¸ßÐÔÄܼÆËãÖÐÊǷdz£³£¼ûµÄ¡£ÎªÁËչʾÕâÒ»µã£¬¼ÙÉèÄúÓÐÁ½¸öË«¾«¶ÈµÄÊý×é a ºÍ b£¬²¢ÇÒÒª´´½¨µÚÈý¸öÊý×é x£¬±ÈÈç x[i]=a[i]+b[i]¡£

¡¡¡¡Èκθ¡µã²Ù×÷£¬ÀýÈç¼Ó·¨ºÍ³Ë·¨£¬¶¼¿ÉÒÔͨ¹ý¼¸¸ö²½ÖèÀ´ÊµÏÖ£º

½øÐÐÖ¸Êýµ÷Õû
Ìí¼Ó·ûºÅ
¶Ô½á¹û½øÐÐÈ¡Õû¼ì²éµÈ
¡¡¡¡ÏòÁ¿´¦ÀíÆ÷ͨ¹ýʹÓà Á÷Ë®Ïߣ¨pipeline£© ¼¼ÊõÔÚÄÚ²¿¶ÔÕâЩ²½Öè½øÐв¢Ðд¦Àí¡£¼ÙÉèÔÚÒ»¸ö¸¡µã¼Ó·¨ÔËËãÖÐÓÐÁù¸ö²½Ö裨Óë IEEE ËãÊõÓ²¼þÒ»Ñù£©£¬Èçͼ 2 Ëùʾ£º


¡¡¡¡Í¼ 2. IEEE ËãÊõÓ²¼þÖеÄÁù¼¶Á÷Ë®Ïß




¡¡¡¡ÏòÁ¿´¦ÀíÆ÷¿ÉÒÔ²¢Ðд¦ÀíÕâÁù¸ö²½Öè ---- Èç¹ûµÚ i ¸öÊý×éÔªËØÊÇÔÚµÚ 4 ¸ö²½ÖèÖб»Ìí¼ÓµÄ£¬ÄÇôÏòÁ¿´¦ÀíÆ÷¾Í»áΪµÚ (i+1) ¸öÔªËØÖ´ÐÐµÚ 3 ¸ö²½Ö裬ΪµÚ (i+2) ¸öÔªËØÖ´ÐÐµÚ 2 ¸ö²½Ö裬ÒÀ´ËÀàÍÆ¡£ÕýÈçÄú¿ÉÒÔ¿´µ½µÄÒ»Ñù£¬¶ÔÓÚÒ»¸ö 6 ¼¶µÄ¸¡µã¼ÓÔËËãÀ´Ëµ£¬¼ÓËٱȷdz£½Ó½üÓÚ 6£¨ÔÚ¿ªÊ¼ºÍ½áÊøʱ£¬ÕâÁù¸ö²½Öè²¢²»ÊǶ¼´¦Óڻ״̬µÄ£©£¬ÒòΪÔÚÈκθø¶¨µÄʱ¿Ì£¨Í¼ 2 ËùʾµÄºìÉ«£©£¬ÕâЩ²½Ö趼ÊǻµÄ¡£ÕâÑù×öµÄÒ»´óÓŵãÊDz¢Ðд¦Àí¶¼ÊÇÔÚÄ»ºó½øÐеģ¬Äú²¢²»ÐèÒªÔÚ³ÌÐòÖÐÏÔʽµØ½øÐбàÂë¡£

¡¡¡¡¶ÔÓڴ󲿷ÖÇé¿öÀ´Ëµ£¬ÕâÁù¸ö²½Ö趼¿ÉÒÔ²¢ÐÐÖ´ÐУ¬ÕâÑù¾Í¿ÉÒÔ»ñµÃ¼¸ºõ 6 ±¶µÄÐÔÄÜÌá¸ß¡£¼ýÍ·±íʾÁË¶ÔµÚ i ¸öÊý×éÔªËØËù½øÐеIJÙ×÷¡£

¡¡¡¡ÓëÏòÁ¿´¦ÀíÏà±È£¬»ùÓÚ¼¯ÈºµÄ¼ÆËã²ÉÓõÄÊÇÍêÈ«²»Í¬µÄÒ»ÖÖ·½·¨¡£Ëü²»Ê¹ÓÃרÃÅÓÅ»¯¹ýµÄÏòÁ¿Ó²¼þ£¬¶øÊÇʹÓñê×¼µÄ±êÁ¿´¦ÀíÆ÷£¬µ«ÊÇËü²ÉÓÃÁË´óÁ¿µÄ´¦ÀíÆ÷À´²¢Ðд¦Àí¶à¸ö¼ÆËãÈÎÎñ¡£

¡¡¡¡¼¯ÈºµÄÌØÐÔÈçÏ£º

¼¯Èº¶¼ÊÇʹÓó£¼ûµÄÓ²¼þ½øÐй¹½¨µÄ£¬Æä³É±¾Ö»ÊÇÏòÁ¿´¦ÀíÆ÷µÄºÜСһ²¿·Ö¡£ÔںܶàÇé¿öÖУ¬¼Û¸ñ»áµÍÒ»¸öÊýÁ¿¼¶ÒÔÉÏ¡£
¼¯ÈºÊ¹ÓÃÏûÏ¢´«µÝϵͳ½øÐÐͨÐÅ£¬³ÌÐò±ØÐëÏÔʽµØ½øÐбàÂëÀ´Ê¹Ó÷ֲ¼Ê½Ó²¼þ¡£
²ÉÓü¯Èº£¬Äú¿ÉÒÔ¸ù¾ÝÐèÒªÏò¼¯ÈºÖÐÌí¼Ó½Úµã¡£
¿ª·ÅÔ´ÂëÈí¼þ×é¼þºÍ Linux ½µµÍÁËÈí¼þµÄ³É±¾¡£
¼¯ÈºµÄά»¤³É±¾ºÜµÍ£¨ËüÃÇÕ¼ÓõĿռä½ÏС£¬ºÄ·ÑµÄµçÁ¦½ÏÉÙ£¬¶ÔÓÚÖÆÀäÌõ¼þµÄÐèÇó½ÏµÍ£©¡£
²¢Ðбà³ÌºÍ Amdahl ·¨Ôò

¡¡¡¡µ±ÔÚ¼¯ÈºÉÏʵÏÖ¸ßÐÔÄÜ»·¾³Ê±£¬Èí¼þºÍÓ²¼þ¾ÍÐèÒªÁªºÏÆðÀ´¹¤×÷¡£³ÌÐòÔÚ±àдʱ±ØÐëÒªÏÔʽµØÀûÓõײãÓ²¼þµÄÓŵ㣬Èç¹ûÏÖÓеķDz¢ÐгÌÐò²»ÄܺܺõØÔÚ¼¯ÈºÉÏÔËÐУ¬ÄÇôÕâЩ³ÌÐò±ØÐëÖØнøÐбàд¡£

¡¡¡¡²¢ÐгÌÐòÒ»´ÎÒªÖ´Ðкܶà²Ù×÷¡£ÆäÊýÁ¿È¡¾öÓÚÄ¿Ç°ÕýÔÚ½â¾öµÄÎÊÌâ¡£¼ÙÉèÒ»¸ö³ÌÐòËù»¨·ÑµÄʱ¼äÖÐÓÐ 1/N ÊDz»Äܲ¢Ðд¦ÀíµÄ£¬ÄÇôʣÓàµÄ (1-1/N) ¾ÍÊÇ¿ÉÒÔ²¢Ðд¦ÀíµÄ²¿·Ö£¨Çë²Î¿´Í¼ 3£©¡£


ͼ 3. Amdahl ·¨Ôò



¡¡¡¡´ÓÀíÂÛÉÏÀ´Ëµ£¬Äú¿ÉÒÔ²ÉÓÃÎÞÊýµÄÓ²¼þÀ´´¦Àí²¢ÐÐÖ´ÐеIJ¿·Ö£¬ÉõÖÁÔÚ½Ó½ü 0 µÄʱ¼äÄÚÍê³ÉÕâЩÈÎÎñ£¬µ«ÊǶÔÓÚ´®Ðв¿·ÖÀ´Ëµ£¬ÕâÑù×ö²»»áÓÐÈκÎÌá¸ß¡£½á¹ûÊÇ£¬¿ÉÒÔʵÏÖµÄ×î¼Ñ½á¹ûÊÇʹÓÃÔ­À´µÄ 1/N µÄʱ¼äÀ´Ö´ÐÐÕû¸ö³ÌÐò£¬µ«ÊDz»¿ÉÄÜÔÙ¿ìÁË¡£ÔÚ²¢Ðбà³ÌÖУ¬Õâ¸öÊÂʵͨ³£¾Í³ÆΪ Amdahl ·¨Ôò¡£

¡¡¡¡Amdahl ·¨Ôò½ÒʾÁËʹÓò¢Ðд¦ÀíÆ÷À´½â¾öÎÊÌâÓëֻʹÓÃÒ»¸ö´®Ðд¦ÀíÆ÷À´½â¾öÎÊÌâµÄ¼ÓËٱȡ£¼ÓËٱȣ¨speedup£© µÄ¶¨ÒåÈçÏ£º£¨Ê¹Óöà¸ö´¦ÀíÆ÷£©²¢ÐÐÖ´ÐгÌÐòËùÐèÒªµÄʱ¼ä³ýÒÔ£¨Ê¹ÓÃÒ»¸ö´¦ÀíÆ÷£©´®ÐÐÖ´ÐгÌÐòËùÐèÒªµÄʱ¼ä£º

T(1)
S = ------
T(j)


¡¡¡¡ÆäÖÐ T(j) ÊÇÔÚʹÓà j ¸ö´¦ÀíÆ÷À´Ö´ÐгÌÐòʱËùÐèÒªµÄʱ¼ä¡£

¡¡¡¡ÔÚͼ 3 ÖУ¬Èç¹û²ÉÓÃ×ã¹»¶àµÄ½ÚµãÀ´½øÐв¢Ðд¦Àí£¬ÄÇô T'par ¾Í¿ÉÒԷdz£½Ó½üÓÚ 0£¬µ«ÊÇ Tseq È´²»»á±ä»¯¡£ÔÚ×îºÃµÄÇé¿öÖУ¬²¢ÐгÌÐòÒ²²»¿ÉÄÜ¿ìµ½Ô­À´µÄ 1+Tpar

/Tseq¡£

¡¡¡¡ÔÚ±àд²¢ÐгÌÐòʱÕæÕýÀ§ÄѵÄÊÂÇéÊÇʹ N ¾¡Á¿´ó¡£µ«ÊÇÕâ¼þÊÂÇéÈ´ÓÐÁ½ÃæÐÔ¡£Í¨³£¶¼ÊÇÒªÊÔͼÔÚ¸üΪǿ´óµÄ¼ÆËã»úÉÏÀ´½â¾ö¸ü´óµÄÎÊÌ⣬ͨ³£Ëæ×ÅËù½â¾öÎÊÌâµÄ¹æÄ£µÄÔö´ó£¨ÀýÈçÊÔͼÐ޸ijÌÐò²¢Ìá¸ß¿É²¢ÐеIJ¿·ÖÀ´ÓÅ»¯µØÀûÓÿÉÓÃ×ÊÔ´£©£¬Ëù»¨·ÑÔÚ´®Ðв¿·ÖÉϵÄʱ¼ä¾Í»á¼õÉÙ¡£Òò´Ë£¬N Öµ¾Í»á×Ô¶¯±ä´óÁË¡£

¡¡¡¡²¢Ðбà³ÌµÄ·½·¨

¡¡¡¡ÏÖÔÚÈÃÎÒÃǽéÉÜÁ½ÖÖ²¢Ðбà³ÌµÄ·½·¨£º·Ö²¼Ê½ÄÚ´æ·½·¨ ºÍ ¹²ÏíʽÄÚ´æ·½·¨¡£

¡¡¡¡·Ö²¼Ê½ÄÚ´æ·½·¨

¡¡¡¡´Ë´¦ÎÒÃÇ¿¼ÂÇÒ»ÖÖÖ÷´Óģʽ·Ç³£ÓÐÓãº

Ö÷½Úµã¸ºÔð½«ÈÎÎñ»®·Öµ½¶à¸ö´Ó½ÚµãÉÏ¡£
´Ó½Úµã¸ºÔð´¦Àí×Ô¼ºËù½ÓÊÕµ½µÄÈÎÎñ¡£
Èç¹ûÐèÒª£¬´Ó½ÚµãÖ®¼ä»áÏ໥½øÐÐͨÐÅ¡£
´Ó½Úµã½«½á¹û·µ»Ø¸øÖ÷½Úµã¡£
Ö÷½ÚµãÊÕ¼¯½á¹û£¬²¢¼ÌÐø·Ö·¢ÈÎÎñ£¬ÒÀ´ËÀàÍÆ¡£
¡¡¡¡ÏÔÈ»£¬ÕâÖÖ·½·¨µÄÎÊÌâ¾Í²úÉúÓÚ·Ö²¼Ê½ÄÚ´æµÄ×éÖ¯¡£ÓÉÓÚÿ¸ö½Úµã¶¼Ö»ÄÜ·ÃÎÊ×Ô¼ºµÄÄڴ棬Èç¹ûÆäËû½ÚµãÐèÒª·ÃÎÊÕâЩÄÚ´æÖеÄÊý¾Ý£¬¾Í±ØÐë¶ÔÕâЩÊý¾Ý½á¹¹½øÐи´ÖƲ¢Í¨¹ýÍøÂç½øÐд«ËÍ£¬Õâ»áµ¼Ö´óÁ¿µÄÍøÂ縺ÔØ¡£Òª±àдÓÐЧµÄ·Ö²¼Ê½ÄÚ´æµÄ³ÌÐò£¬¾Í±ØÐëÀμÇÕâ¸öȱµãºÍÖ÷´ÓÄ£ÐÍ¡£

¡¡¡¡¹²ÏíʽÄÚ´æ·½·¨

¡¡¡¡ÔÚ¹²ÏíʽÄÚ´æ·½·¨ÖУ¬ÄÚ´æ¶ÔÓÚËùÓеĴ¦ÀíÆ÷£¨ÀýÈç SMP£©À´Ëµ¶¼ÊÇͨÓõġ£ÕâÖÖ·½·¨²¢Ã»Óзֲ¼Ê½ÄÚ´æ·½·¨ÖÐËùÌáµ½µÄÄÇЩÎÊÌâ¡£¶øÇÒ¶ÔÓÚÕâÖÖϵͳ½øÐбà³ÌÒª¼òµ¥ºÜ¶à£¬ÒòΪËùÓеÄÊý¾Ý¶ÔÓÚËùÓеĴ¦ÀíÆ÷À´Ëµ¶¼ÊÇ¿ÉÒÔʹÓõģ¬ÕâÓë´®ÐгÌÐò²¢Ã»ÓÐÌ«¶àÇø±ð¡£ÕâЩϵͳµÄÒ»¸ö´óÎÊÌâÊÇ¿ÉÉìËõÄÜÁ¦£º²»ÈÝÒ×Ìí¼ÓÆäËû´¦ÀíÆ÷¡£

¡¡¡¡²¢Ðбà³Ì£¨ÓëËùÓеıà³Ì¼¼ÊõÒ»Ñù£©ÓëÆäËû¿ÆѧһÑù£¬¶¼ÊÇÒ»ÃÅÒÕÊõ£¬×Ü»áÁôÏÂÒ»¶¨µÄ¿Õ¼äÀ´½øÐÐÉè¼ÆµÄ¸Ä½øºÍÐÔÄܵÄÌá¸ß¡£²¢Ðбà³ÌÔÚ¼ÆËãÖÐÓÐ×Ô¼ºÌØÊâµÄµØλ£º±¾ÏµÁÐÎÄÕÂµÄµÚ 2 ²¿·Ö½«½éÉܲ¢Ðбà³Ìƽ̨£¬²¢¸ø³ö¼¸¸öÀý×Ó¡£

¡¡¡¡µ±Îļþ I/O ³ÉΪƿ¾±Ê±Ôõô°ì£¿

¡¡¡¡ÓÐЩӦÓóÌÐòͨ³£»áÐèÒª´Ó´ÅÅÌÖжÁд´óÁ¿µÄÊý¾Ý£¬Õâͨ³£ÊÇÕû¸ö¼ÆËã¹ý³ÌÖÐËÙ¶È×îÂýµÄÒ»¸ö²½Öè¡£¸ü¿ìµÄÓ²ÅÌÇý¶¯Æ÷Äܹ»°ïÖú½â¾öһЩÎÊÌ⣬µ«ÊÇÓÐʱÕâÊDz»¹»µÄ¡£

¡¡¡¡Èç¹ûÒ»¸öÎïÀí´ÅÅÌ·ÖÇøÊÇÔÚËùÓнڵãÖ®¼ä¹²ÏíµÄ£¨ÀýÈçʹÓà NFS£©£¬¾ÍÏñÊÇÔÚ Linux ¼¯ÈºÖо­³£²ÉÓõķ½·¨Ò»Ñù£¬ÄÇôÕâ¸öÎÊÌâ¾Í»á±äµÃ¸ü¼ÓÃ÷ÏÔÁË¡£´Ëʱ¾ÍÊDz¢ÐÐÎļþϵͳµÄÓÃÎäÖ®µØÁË¡£

¡¡¡¡²¢ÐÐÎļþϵͳ£¨Parallel filesystem£© ½«Êý¾Ý´æ·ÅÔÚ·Ö²¼ÔÚ¶à¸ö´ÅÅÌÉϵÄÎļþÖУ¬ÕâЩ´ÅÅÌÁ¬½Óµ½¼¯ÈºÖеĶà¸ö½ÚµãÉÏ£¬ÕâЩ½Úµã³ÆΪ I/O ½Úµã¡£µ±Ò»¸ö³ÌÐòÊÔͼ¶Áȡij¸öÎļþʱ£¬¿ÉÒÔ²¢ÐеشӶà¿é´ÅÅÌÉÏ·Ö±ð¶ÁÈ¡Õâ¸öÎļþµÄijЩ²¿·Ö¡£Õâ¿ÉÒÔ½µµÍij¸ö´ÅÅÌ¿ØÖÆÆ÷ÉϵĸºÔØ£¬²¢Äܹ»´¦Àí¸ü¶àÇëÇó¡££¨PVFS ¾ÍÊÇÒ»¸öºÜºÃµÄ¿ª·ÅÔ´Âë²¢ÐÐÎļþϵͳ£»Ä¿Ç°ÒѾ­ÔÚ Linux ¼¯ÈºÉÏʹÓñê×¼µÄ IDE Ó²ÅÌʵÏÖÁ˳¬¹ý 1 GB/s µÄ´ÅÅÌÐÔÄÜ¡££©

¡¡¡¡PVFS ¿ÉÒÔ×÷Ϊһ¸ö Linux ÄÚºËÄ£¿éʹÓã¬Ò²¿ÉÒÔ±àÒëµ½ Linux ÄÚºËÖС£µ×²ãµÄ¸ÅÄî·Ç³£¼òµ¥£¨Çë²Î¿´Í¼ 4£©£º

ÔªÊý¾Ý·þÎñÆ÷¸ºÔð´æ´¢ÎļþµÄÄÄЩ²¿·Ö´æ´¢ÔÚʲôµØ·½µÄÐÅÏ¢¡£
¶à¸ö I/O ½ÚµãÉÏ´æ´¢ÁËÎļþµÄ¸÷¸ö²¿·Ö£¨PVFS µ×²ã¿ÉÒÔʹÓÃÈκγ£¼ûµÄÎļþϵͳ£¬ÀýÈç ext3 £©¡£

ͼ 4. PVFS ÊÇÈçºÎ¹¤×÷µÄ




¡¡¡¡µ±¼¯ÈºÖеļÆËã½ÚµãÏëÒª·ÃÎʲ¢ÐÐÎļþϵͳÖеÄÒ»¸öÎļþʱ£¬ËüÐèÒªÖ´ÐÐÒÔϲ½Ö裺

Ïñƽ³£Ò»ÑùÇëÇóÎļþ£¬ÇëÇó±»´«Ë͵½µ×²ãµÄ PVFS ÎļþϵͳÖС£
PVFS ÏòÔªÊý¾Ý·þÎñÆ÷·¢ËÍÒ»¸öÇëÇó£¨Í¼ 4 ÖеIJ½Öè 1¡¢2£©£¬Õâ»á֪ͨÇëÇó½ÚµãÓйØÎļþÔÚ¸÷¸ö I/O ½ÚµãÉϵÄλÖõÄÐÅÏ¢¡£
ʹÓÃÕâЩÐÅÏ¢£¬¼ÆËã½ÚµãÖ±½ÓÓëËùÓÐÏà¹ØµÄ I/O ½Úµã½øÐÐͨÐÅ£¬»ñµÃÕû¸öÎļþ£¨²½Öè 3£©¡£
¡¡¡¡ÕâЩ²½Öè¶ÔÓÚµ÷ÓÃÓ¦ÓóÌÐòÀ´Ëµ¶¼ÊÇ͸Ã÷µÄ£»µ×²ã¶ÔËùÓÐ I/O ½Úµã·¢³öÇëÇóµÄ¸´ÔÓÐÔ¡¢»ñÈ¡ÎļþµÄÄÚÈݵȵȣ¬¶¼ÊÇÓÉ PVFS ´¦ÀíµÄ¡£

¡¡¡¡ÓÐ¹Ø PVFS ÓÐÒ»¼þºÃµÄÊÂÇ飺²»Ðè×öÈκÎÐ޸ľͿÉÒÔÔÚÆäÉÏÔËÐÐÆÕͨÎļþϵͳµÄ¶þ½øÖÆÐÎʽ ---- ÕâÔÚ²¢Ðбà³ÌÁìÓò¶àÉÙÊǸöÀýÍâ¡£

´´½¨Ò»¸ö¼òµ¥µÄ Linux ¼¯Èº

Óйؼ¯Èº×îÓÐȤµÄÊÂÇéÖ®Ò»ÊÇ£¬Èç¹ûÎÒÃÇÓлù±¾µÄ Linux °²×°£¬²¢ÇҾ߱¸Ò»¶¨µÄ¹ÊÕÏÅųýµÄ¼¼ÄÜ£¬Ö»ÐèÒªºÜÉÙµÄŬÁ¦¾Í¿ÉÒÔ¹¹½¨»ùÓÚ Linux µÄ¼¯Èº¡£ÈÃÎÒÃÇÀ´¿´Ò»ÏÂÕâÊÇÈçºÎʵÏֵġ£

¶ÔÓÚÎÒÃǵļ¯Èº£¬ÒªÊ¹Óà MPICH ºÍÒ»×éÆÕͨµÄ Linux ¹¤×÷Õ¾¡£ÎªÁ˼òµ¥Æð¼û£¬²¢ÇÒÖصãÍ»³öÆäÖеĻù±¾Ô­Àí£¬ÎÒÃǽ«¹¹½¨×îСµÄÂãϵͳ£¬ÔÚ¼¯Èº»·¾³ÖпÉÒÔʹÓÃËüÀ´ÔËÐв¢ÐгÌÐò¡£

±¾½ÚÖиø³öµÄ 7 ¸ö²½Ö轫ÏÔʾÈçºÎ¹¹½¨Âãϵͳ¡£¹¹½¨½¡×³µÄ¼¯ÈºÒÔ¼°¼¯ÈºµÄ¹ÜÀíÉæ¼°ºÜ¶à¹¤×÷£¬ÎÒÃÇÔÚ±¾ÎĺóÃæ½øÐнéÉÜ¡£

²½Öè 1

Èç¹ûÏë»ñµÃÒ»¸öÕæÕýµÄ¼¯Èº£¬ÖÁÉÙÐèÒªÁ½Ì¨ Linux »úÆ÷¡£Á½¸ö VMware Ó³ÏñÒ²¿ÉÒԺܺõØʵÏÖÕâÖÖ¹¦ÄÜ¡££¨Ê¹Óà VMware£¬ÏÔÈ»ÎÒÃDz¢²»»áÆÚÍûÄÜ»ñµÃʲôÐÔÄÜÓÅÊÆ¡£Êµ¼ÊÉÏ£¬ÆäÐÔÄÜÏÔÈ»»áÓÐËùϽµ£¬ÒòΪ CPU ÐèÒª½øÐй²Ïí¡££©ÇëÈ·±£ÕâЩ»úÆ÷±Ë´ËÖ®¼ä¿ÉÒÔʹÓûúÆ÷ÃûÏ໥ ping ͨ¡£·ñÔò£¬¾ÍÐèÒªÔÚ /etc/hosts ÖÐÌí¼ÓÊʵ±µÄÏî¡£

²½Öè 2

°²×° GNU C ±àÒëÆ÷ºÍ GNU FORTRAN ±àÒëÆ÷¡£

²½Öè 3a

ΪËùÓнڵãÅäÖà SSH£¬ÔÊÐí²»Ñ¯ÎÊÃÜÂë¾Í¿ÉÒÔÖ´ÐÐÃüÁî¡£ÕâÑù×öµÄÄ¿µÄÊÇÄܹ»²»ÐèѯÎÊÃÜÂë¾Í¿ÉÒÔÖ´ÐÐ ssh -n host whoami ÕâÑùµÄÃüÁî¡£SSH ÓÃ×÷²»Í¬»úÆ÷Ö®¼äµÄͨÐÅ·½·¨¡££¨Ò²¿ÉÒÔʹÓà rsh À´ÊµÏÖÕâÖÖ¹¦ÄÜ¡££©

²½Öè 3b

ssh-keygen -f /tmp/key -t dsa ¿ÉÒÔÔÚÎļþ key ÖÐÉú³ÉÒ»¸ö˽Կ£¬ÔÚÎļþ key.pub ÖÐÉú³ÉÒ»¸ö¹«Ô¿¡£

²½Öè 3c

Èç¹ûÕýÔÚÒÔ root Óû§µÄÉí·Ý¹¹½¨¼¯Èº£¬²¢ÇÒÒÔ root Óû§µÄÉí·ÝÀ´ÔËÐгÌÐò£¨ÏÔȻֻÓÐÔÚ½øÐÐʵÑéʱ²Å»áÕâÑù£©£¬ÄÇô¾Í¿ÉÒÔ½«Ë½Ô¿¿½±´µ½Îļþ /root/.ssh/identity ÖУ¬²¢½«¹«Ô¿¿½±´µ½¼¯ÈºÖÐËùÓнڵãÉ쵀 /root/.ssh/authorized_keys ÎļþÖС£

ΪÁËÈ·±£ËùÓеÄÅäÖö¼ÄÜÕý³£¹¤×÷£¬ÇëÖ´ÐÐÏÂÃæµÄÃüÁssh -n hostname 'date'£¬²¢²é¿´Õâ¸öÃüÁîÄÜ·ñ³É¹¦Ö´ÐУ¬¶ø²»»á³öÏÖÈκδíÎó¡£Ó¦¸Ã¶ÔËùÓнڵ㶼ִÐÐÕâÖÖ²âÊÔ£¬ÕâÑù¾Í¿ÉÒÔÈ·±£ËùÓнڵãÉϵÄÉèÖö¼Ã»ÓÐÎÊÌâ¡£

×¢Ò⣺¿ÉÄÜ»¹ÐèÒªÐ޸ķÀ»ðǽµÄÅäÖã¬Ê¹ÆäÔÊÐí½Úµã±Ë´ËÖ®¼äÏ໥½øÐÐͨÐÅ¡£

²½Öè 4a

½ÓÏÂÀ´£¬ÎÒÃǽ«°²×° MPICH¡£´Ó anl.gov µÄ Web Õ¾µã£¨Çë²ÎÔÄ ²Î¿¼×ÊÁÏ ÖеÄÁ´½Ó£©ÉÏÏÂÔØ UNIX °æ±¾µÄ MPICH¡£ÏÂÃæÊÇÒ»¸ö¼òÒª½éÉÜ¡£

²½Öè 4b

¼ÙÉèÄúÒѾ­½«ËùÏÂÔØµÄ mpich.tar.gz ·Åµ½ÁË /tmp ÖУº

cd /tmp
tar -xvf mpich.tar.gz £¨¼ÙÉèÖ´ÐÐÕâ¸öÃüÁîÖ®ºó»áµÃµ½Ò»¸ö /tmp/mpich-1.2.6 Ŀ¼£©
cd /tmp/mpich-1.2.6

²½Öè 4c

./configure -rsh=ssh ---- Õâ¸æËß MPICH ʹÓà ssh ×÷ΪͨÐÅ»úÖÆ¡£

²½Öè 4d

make ---- Ö´ÐÐÍêÕâ¸ö²½ÖèÖ®ºó£¬¾ÍÒѾ­°²×°ºÃ MPICH ÁË¡£

²½Öè 5

ÒªÈà MPICH ÖªµÀËùÓеĽڵ㣬Çë±à¼­Îļþ /tmp/mpich-1.2.6/util/machines/machines.LINUX£¬²¢½«ËùÓнڵãµÄÖ÷»úÃûÌí¼Óµ½Õâ¸öÎļþÖУ¬ÕâÑù°²×°µÄ MPICH ¾Í¿ÉÒÔÖªµÀËùÓеĽڵãÁË¡£Èç¹ûÒÔºóÔÙÌí¼ÓеĽڵ㣬ҲÇëÐÞ¸ÄÕâ¸öÎļþ¡£

²½Öè 6

½«Ä¿Â¼ /tmp/mpich-1.2.6 ¿½±´µ½¼¯ÈºÖеÄËùÓнڵãÉÏ¡£

²½Öè 7

ÔÚ examples ÖÐÔËÐм¸¸ö²âÊÔ³ÌÐò£º

cd /tmp/mpich-1.2.6/utils/examples
make cpi
/tmp/mpich-1.2.6/bin/mpirun -np 4 cpi ---- ¸æËß MPICH ÔÚ 4 ¸ö´¦ÀíÆ÷ÉÏÔËÐгÌÐò£»Èç¹ûÅäÖÃÖÐûÓÐ 4 ¸ö´¦ÀíÆ÷£¬Ò²²»Óõ£ÐÄ£»MPICH »á´´½¨Ò»Ð©½ø³ÌÀ´²¹³¥ÎïÀíÓ²¼þµÄȱʧ¡£
ÏÖÔÚ¼¯ÈºÒѾ­×¼±¸ºÃÁË£¡ÕýÈçÎÒÃÇ¿ÉÒÔ¿´µ½µÄÒ»Ñù£¬ËùÓеÄÖØÍ·Ï·¶¼¿ÉÒÔÁô¸ø MPI ʵÏÖÀ´Íê³É¡£ÕýÈçÇ°Ãæ½éÉܵÄÒ»Ñù£¬ÕâÊÇÒ»¸öÂ㼯Ⱥ£¬ËùÐèµÄ´ó²¿·ÖÊÖ¹¤¹¤×÷Ö»ÊÇÈ·±£»úÆ÷Ö®¼ä¿ÉÒԱ˴˽øÐÐͨÐÅ£¨ÎÒÃÇÅäÖÃÁË ssh£¬MPICH ÊÇÊÖ¹¤¿½±´µÄ£¬µÈµÈ£©¡£

¿ª·ÅÔ´ÂëÈí¼þ¼¯ÈºÓ¦ÓóÌÐò×ÊÔ´

ÓÐÒ»µã·Ç³£Çå³þ£¬ÉÏÃæµÄ¼¯Èº·Ç³£ÄÑÒÔά»¤¡£ÏÖÔÚ²¢²»ÄÜ·½±ãµØ½«Îļþ¿½±´µ½Ã¿¸ö½ÚµãÉÏ¡¢ÔÚÿ¸öÒªÌí¼ÓµÄ½ÚµãÉÏÉèÖà SSH ºÍ MPI ÒÔ¼°ÔÚ½«½ÚµãÒƳö¼¯ÈºÊ±½øÐÐÊʵ±µÄÐ޸ģ¬µÈµÈ¡£

ÐÒÔ˵ÄÊÇ£¬ÓÐһЩÓÅÐãµÄ¿ª·ÅÔ´ÂëÈí¼þ×ÊÔ´¿ÉÒÔ°ïÖúÎÒÃÇÉèÖú͹ÜÀí½¡×³µÄ²úÆ·¼¯Èº¡£OSCAR ºÍ Rocks ¾ÍÊÇÁ½¸öÕâÑùµÄÈí¼þ¡£ÎÒÃÇÔÚ´´½¨¼¯ÈºÊ±ËùÖ´ÐеĴ󲿷ֲÙ×÷¶¼¿ÉÒÔʹÓÃÕâЩ³ÌÐò×Ô¶¯ÊµÏÖ¡£

ͼ 1 ÊÇÒ»¸ö¼òµ¥¼¯ÈºµÄʾÒâͼ¡£


ͼ 1. Ò»¸ö¼òµ¥µÄʾÀý¼¯Èº




OSCAR »¹¿ÉÒÔÖ§³ÖʹÓà PXE£¨Portable Execution Environment£©À´×Ô¶¯°²×° Linux¡£OSCAR »¹¿ÉÒÔ°ïÖúÎÒÃÇʵÏÖÒÔϹ¦ÄÜ£º

ÔÚ¼ÆËã½ÚµãÉÏ×Ô¶¯°²×° Linux¡£


ÅäÖà DHCP ºÍ TFTP£¨¶ÔÓÚʹÓà PXE °²×°µÄ Linux ϵͳ£©¡£´ó²¿·ÖмÆËã»ú¶¼ÓÐÒ»¸öÔÊÐíʹÓà DHCP ·þÎñÆ÷À´Òýµ¼»úÆ÷µÄ BIOS¡£BIOS ÓÐÒ»¸öÄÚ½¨µÄ DHCP ¿Í»§»ú£¬Ëü´´½¨Ò»¸ö²Ù×÷ϵͳӳÏñ£¬²¢Ê¹Óà TFTP ½«Æä´Ó DHCP ·þÎñÆ÷´«Êäµ½ÒªÒýµ¼µÄ»úÆ÷ÉÏ¡£Õâ¸ö Linux Ó³ÏñÊÇÓÉ OSCAR ´´½¨µÄ£¬DHCP ºÍ TFTP µÄ°²×°ºÍÅäÖö¼¿ÉÒÔÓÉ OSCAR À´´¦Àí¡£


ÅäÖÃ SSH¡£


×Ô¶¯ÉèÖà NFS¡£


°²×°²¢ÅäÖà MPI£¨MPICH ºÍ LAM/MPI£©¡£


°²×°²¢ÅäÖà PVM £¨Èç¹ûÏ£ÍûʹÓà PVM£¬¶ø²»ÊÇ MPI£©¡£


ÅäÖÃÍ·½ÚµãºÍ¼ÆËã½ÚµãÖ®¼äµÄ×ÓÍø¡£


°²×°µ÷¶ÈÆ÷£¨Open PBS ºÍ Maui£©£¬ÓÃÓÚ¶à¸öÓû§½«×÷ÒµÌá½»µ½¼¯ÈºÉϵÄ×Ô¶¯¹ÜÀí¡£


°²×° Ganglia£¬ÓÃÓÚÐÔÄܼàÊÓ¡£


×Ô¶¯ÅäÖã¬ÓÃÓÚÌí¼Ó»òɾ³ý½Úµã¡£
ÏÖÔÚ OSCAR ¿ÉÒÔÖ§³Ö¶à¸ö°æ±¾µÄ Red Hat Linux£»ÓйØÆäËû¿ÉÒÔÖ§³ÖµÄ·¢Ðа汾£¬Çë²ÎÔÄ OSCAR µÄ Web Õ¾µã¡£¸ù¾ÝÔÚÉèÖÃʱËùÅöµ½µÄ´íÎ󣬿ÉÄÜÐèÒª¶Ô¼¸¸ö½Å±¾½øÐÐÐ޸ġ£

ʹÓà OSCAR ´´½¨ Linux ¼¯Èº

ÈÃÎÒÃÇʹÓà OSCAR ×ÊÔ´À´¹¹½¨Ò»¸ö¹¦ÄÜÍ걸µÄ¼¯Èº¡£¼ÙÉèÓÐÁ½¸ö»ò¶à¸öÆÕͨµÄ¹¤×÷Õ¾£¬ËüÃǶ¼Ê¹ÓÃÍøÂçÁ¬½ÓÔÚÒ»Æð¡£½«ÆäÖеÄÒ»¸ö½ÚµãÉèÖÃΪͷ½Úµã£¬ÆäËû½Úµã¶¼ÉèÖÃΪ¼ÆËã½Úµã¡£

ÕýÈçÔÚ¹¹½¨ Linux ¼¯ÈºÊ±Ëù×öµÄÒ»Ñù£¬ÎÒÃÇÒªÏêϸ½éÉÜÔÚÍ·½ÚµãÉÏËùÖ´ÐеIJ½Öè¡£OSCAR ¿ÉÒÔ×Ô¶¯ÅäÖÃÆäËû½Úµã£¬°üÀ¨ OS µÄ°²×°¡££¨Çë²ÎÔÄ OSCAR °²×°Ö¸ÄÏ£»ÏÂÃæÊǶ԰²×°¹ý³ÌµÄ¸ÅÄîÐÔ½éÉÜ¡££©

²½Öè 1

ÔÚÍ·½ÚµãÉÏ°²×° Linux¡£È·±£°²×° X ·þÎñÆ÷¡£

²½Öè 2

mkdir /tftpboot, mkdir /tftpboot/rpm¡£½«°²×°¹âÅÌÖеÄËùÓÐ RPM Îļþ¿½±´µ½Õâ¸öĿ¼ÖС£ÕâЩ RPM ÓÃÀ´´´½¨¿Í»§»úÓ³Ïñ¡£²¢·ÇËùÓÐµÄ RPM ×îÖÕ¶¼ÐèÒª£¬µ«ÊÇ×îºÃÈÃËüÃÇ×Ô¶¯¹¹½¨Õâ¸öÓ³Ïñ¡£

²½Öè 3

È·±£ÒѾ­°²×°²¢ÅäÖÃÁË MySQL£¬²¢ÇÒ¿ÉÒÔ´Ó Perl ÖзÃÎÊ MySQL£¬ÒòΪ OSCAR ½«ËùÓеÄÅäÖÃÐÅÏ¢¶¼±£´æµ½ÁË MySQL ÖУ¬²¢Ê¹Óà Perl À´·ÃÎÊÕâЩÐÅÏ¢¡£Õâ¸ö²½Öèͨ³£ÊÇ¿ÉÑ¡µÄ£¬²¢ÇÒ OSCAR Ò²¿ÉÒÔΪÎÒÃÇÖ´ÐÐÕâЩ²½Ö裬µ«ÊÇÓÐʱÕâ¸ö²½Öè»áʧ°Ü£¬ÓÈÆäÊÇÔÚÒ»¸öÉв»Ö§³ÖµÄ·¢Ðа汾ÉÏ°²×°Ê±¸üÊÇÈç´Ë¡£

²½Öè 4

ÏÂÔØ OSCAR Ô´´úÂë²¢±àÒëËü£º

configure
make install

²½Öè 5

Æô¶¯ OSCAR Ïòµ¼¡£¼ÙÉèÎÒÃÇÏëÒªÕâ¸ö¼¯ÈºÊ¹Óà eth1 À´Á¬½Ó¼¯ÈºÖеĽڵ㣬ÇëʹÓà /opt/oscar/install_cluster eth1¡£

²½Öè 6

ÔÚÕâ¸ö²½ÖèÖУ¬Ò»²½²½µØͨ¹ýËùÓÐµÄ OSCAR ÉèÖÃÆÁÄ»¡£È·±£ÒÔÕýÈ·µÄ˳ÐòÖ´ÐÐÒÔϲ½Ö裺

Ñ¡Ôñ°üÀ´¶¨ÖÆ OSCAR µÄ°²×°¡£Èç¹û²»ÊìϤÕâЩ°ü£¬¿ÉÒÔÔÝʱºöÂÔ¡£


°²×° OSCAR °ü¡£
¹¹½¨¿Í»§»úÓ³Ïñ¡£Õâ¾ÍÊǼÆËã½ÚµãҪʹÓõÄÓ³ÏñÎļþ¡£
¶¨Òå OSCAR ¿Í»§»ú¡£ÕⶨÒåµÄÊǼÆËã½Úµã¡£ÎÒÃÇÐèÒªÖ¸¶¨¼¯ÈºÖÐÏëҪʹÓõĽڵãµÄ¸öÊý£¬ÒÔ¼°ËüÃÇËùʹÓõÄ×ÓÍø¡£Èç¹ûÏÖÔÚ²»È·¶¨Ò»¹²ÓжàÉÙ¸ö½Úµã£¬¿ÉÒÔÉÔºóÔÙÀ´Ð޸ġ£
½«²»Í¬½ÚµãµÄ MAC µØÖ·Ó³ÉäΪ IP µØÖ·¡£¶ÔÓÚÕâ¸ö²½Ö裬ÿ¸ö½Úµã¶¼±ØÐëÔÚ BIOS ÖÐʹÓà PXE ÍøÂçÆô¶¯Ñ¡ÏîÀ´Æô¶¯¡£
²½Öè 7

×îºó£¬ÔËÐвâÊÔ¡£Èç¹ûÒ»ÇÐÔËÐÐÁ¼ºÃ£¬Ã¿¸ö²âÊÔ¶¼Ó¦¸Ã³É¹¦¡£¼´Ê¹Ã»ÓÐÈκÎÎÊÌ⣬ÓÐʱµÚÒ»´Î³¢ÊÔÔËÐÐʱҲ»áÓÐЩ²âÊÔʧ°Ü¡£»¹¿ÉÒÔͨ¹ýÖ´ÐÐ /opt/oscar ÏÂÃæµÄ²âÊԽű¾À´ÊÖ¹¤Ö´ÐÐÕâЩ²âÊÔ¡£

Èç¹ûÎÒÃÇÏÖÔÚÏ£ÍûÌí¼ÓеĽڵ㣬¿ÉÒÔÔÙ´ÎÆô¶¯ OSCAR Ïòµ¼²¢Ìí¼Ó½Úµã¡£OSCAR »áʹÓà PXE ×Ô¶¯½« Linux OS °²×°µ½ÕâЩ½ÚµãÉÏ¡£

ÏÖÔÚÎÒÃÇÒѾ­×¼±¸ºÃ¼¯Èº»·¾³ÁË£¬½ÓÏÂÀ´¿ÉÒÔÔËÐв¢ÐгÌÐòÁË£¬²¢ÇÒ¿ÉÒÔ¸ù¾ÝÐèÒªÌí¼Ó»òɾ³ýнڵ㣬²¢Ê¹Óà Ganglia À´¼àÊÓ½ÚµãµÄ״̬¡£

¹ÜÀí¼¯Èº

µ±ÎÒÃÇÐèÒªÔÚÒ»¸ö¾ßÓдóÁ¿Óû§µÄ²úÆ·»·¾³ÖжԼ¯Èº½øÐйÜÀíʱ£¬×÷Òµµ÷¶ÈºÍ¼àÊӾͱäµÃÓÈÆäÖØÒªÁË¡£

×÷Òµµ÷¶È

MPI ¿ÉÒÔÔÚ¸÷¸ö½ÚµãÉÏÆô¶¯²¢Í£Ö¹½ø³Ì£¬µ«ÊÇÕâÖ»ÄÜÏÞ¶¨ÓÚͬһ¸ö³ÌÐò¡£ÔÚÒ»¸öµäÐ͵ļ¯ÈºÉÏ£¬»áÓкܶàÓû§¶¼ÒªÔËÐÐ×Ô¼ºµÄ³ÌÐò£¬ÎÒÃDZØÐëʹÓõ÷¶ÈÈí¼þÀ´È·±£ËüÃÇ¿ÉÒÔ×îÓŵØʹÓü¯Èº¡£

Ò»¸öÁ÷Ðеĵ÷¶ÈϵͳÊÇ OpenPBS£¬¿ÉÒÔʹÓà OSCAR ×Ô¶¯°²×°Ëü¡£Ê¹ÓÃÕâ¸öµ÷¶Èϵͳ£¬¿ÉÒÔÔÚ¼¯ÈºÉÏ´´½¨×÷Òµ£¬²¢½«×÷ÒµÌá½»µ½¼¯ÈºÉÏÔËÐС£ÔÚ OpenPBS ÖУ¬»¹¿ÉÒÔ´´½¨¸´ÔÓµÄ×÷Òµµ÷¶È²ßÂÔ¡£

ʹÓà OpenPBS »¹¿ÉÒԲ鿴ÕýÔÚÖ´ÐеÄ×÷Òµ¡¢Ìá½»×÷ÒµÒÔ¼°È¡Ïû×÷Òµ¡£Ëü»¹¿ÉÒÔ¿ØÖÆij¸ö×÷Òµ¿ÉÒÔʹÓÃµÄ CPU ʱ¼äµÄ×î´óÖµ£¬Õâ¶ÔÓÚϵͳ¹ÜÀíÔ±À´Ëµ·Ç³£ÓÐÓá£

¼àÊÓ

¼¯Èº¹ÜÀíÖеÄÒ»¸öÖØÒª·½Ãæ¾ÍÊǼàÊÓ£¬ÓÈÆäÊÇÈç¹û¼¯ÈºÖÐÓдóÁ¿µÄ½Úµã¾Í¸üÊÇÈç´Ë¡£´Ë´¦Óм¸ÖÖÑ¡Ôñ£¬ÀýÈç Ganglia£¨OSCAR ¿ÉÒÔÌṩ£©ºÍ Clumon¡£

Ganglia ÓÐÒ»¸ö»ùÓÚ Web µÄÇ°¶Ë½çÃ棬¿ÉÒÔÌṩÓÐ¹Ø CPU ºÍÄÚ´æʹÓÃÇé¿öµÄʵʱ¼àÊÓÐÅÏ¢£»¿ÉÒÔ·½±ãµØ¶ÔÆä½øÐÐÀ©Õ¹£¬Ê¹ÆäÖ»¼àÊÓÓйØijÏîÄÚÈݵÄÐÅÏ¢¡£ÀýÈ磬ʹÓÃһЩ¼òµ¥µÄ½Å±¾£¬ÎÒÃǾͿÉÒÔÈà Ganglia »ã±¨ CPU µÄζȡ¢·çÉÈתËٵȵȡ£ÔÚ½ÓÏÂÀ´µÄ¼¸½ÚÖУ¬ÎÒÃǽ«±àдһЩ²¢ÐгÌÐò£¬²¢ÔÚÕâ¸ö¼¯ÈºÉÏÔËÐÐÕâЩ²¢ÐгÌÐò¡£

²¢ÐÐËã·¨

²¢Ðбà³ÌÓÐ×Ô¼ºµÄһЩ²¢ÐÐËã·¨£¬ËüÃÇ¿ÉÒÔ³ä·ÖÀûÓõײãÓ²¼þµÄÐÔÄÜ¡£½ÓÏÂÀ´ÈÃÎÒÃÇÀ´Á˽âÒ»ÏÂÕâÖÖËã·¨µÄÐÅÏ¢¡£ÈÃÎÒÃǼÙÉèÒ»¸ö½ÚµãÒª¶ÔÒ»×é N ¸öÕûÊý½øÐÐÇóºÍÔËËã¡£ÓÃÆÕͨ·½·¨ÊµÏÖÕâÖÖ²Ù×÷ËùÐèÒªµÄʱ¼äÊÇ O(N)£¨Èç¹û¶Ô 100 ¸öÕûÊý½øÐÐÇóºÍÐèÒª 1ms£¬ÄÇô¶Ô 200 ¸öÕûÊý½øÐÐÇóºÍ¾ÍÐèÒª 2ms£¬ÒÀ´ËÀàÍÆ£©¡£

Õâ¸öÎÊÌâ¿´ÆðÀ´ºÜÄÑÏßÐÔµØÌá¸ßÆäËٶȣ¬µ«ÊÇÖµµÃ×¢ÒâµÄÊÇ£¬µÄÈ·ÓÐÕâÑùÒ»ÖÖ·½·¨¡£ÈÃÎÒÃÇÀ´¿´Ò»¸öÔÚ 4 ¸ö½ÚµãµÄ¼¯ÈºÉÏÖ´ÐгÌÐòµÄÀý×Ó£¬Ã¿¸ö½ÚµãµÄÄÚ´æÖж¼ÓÐÒ»¸öÕûÊý£¬³ÌÐòµÄÄ¿µÄÊǶÔÕâ 4 ¸öÕûÊýÇóºÍ¡£

¿¼ÂÇÏÂÃæµÄ²½Ö裺

½Úµã 2 ½«×Ô¼ºµÄÕûÊý·¢Ë͸ø½Úµã 1£¬½Úµã 4 ½«×Ô¼ºµÄÕûÊý·¢Ë͸ø½Úµã 3¡£ÏÖÔÚ½Úµã 1 ºÍ½Úµã 3 ¶¼ÓÐÁ½¸öÕûÊýÁË¡£
ÕâЩÕûÊýÔÚÕâÁ½¸ö½ÚµãÉÏ·Ö±ð½øÐÐÇóºÍ¡£
½Úµã 3 ½«ËüµÄ²¿·ÖºÍ·¢Ë͸ø½Úµã 1¡£ÏÖÔÚ½Úµã 1 ÓÐÁ½¸ö²¿·ÖºÍÁË¡£
½Úµã 1 ¶ÔÕâЩ²¿·ÖºÍ½øÐÐÇóºÍ£¬´Ó¶øµÃ³ö×îÖÕµÄ×ܺ͡£
ÕýÈçÎÒÃÇ¿ÉÒÔ¿´µ½µÄÒ»Ñù£¬Èç¹û×î³õÓÐ 2N ¸öÊý×Ö£¬ÕâÖÖ·½·¨ÔÚ ~N ¸ö²½ÖèÖоͿÉÒÔʵÏÖÇóºÍÔËËã¡£Òò´ËËã·¨µÄ¸´ÔÓ¶ÈÊÇ O(log2N)£¬ÕâÏà¶ÔÓÚÇ°ÃæµÄ O(N) À´½²ÊÇÒ»¸ö¼«´óµÄ¸Ä½ø¡££¨Èç¹û¶Ô 128 ¸öÊý×Ö½øÐÐÇóºÍÐèÒª 1ms£¬ÄÇôʹÓÃÕâÖÖ·½·¨¶Ô 256 ¸öÊý×Ö½øÐÐÇóºÍ¾ÍÖ»ÐèÒª (8/7) ~ 1.2ms¡£ÔÚÇ°ÃæµÄ·½·¨ÖУ¬ÕâÐèÒª 2ms¡££©

ÕâÖÖ·½·¨ÔÚÿ¸ö²½ÖèÖж¼¿ÉÒÔÊÍ·ÅÒ»°ëµÄ¼ÆËã½Úµã¡£ÕâÖÖË㷨ͨ³£¾Í³ÆΪµÝ¹é¶þ·ÖºÍ±¶Ôö£¨recursive halving and doubling£©·¨£¬Ëü¾ÍÊÇÔÚ MPI ÖÐ reduce º¯Êýµ÷ÓõÄÀà±³ºóËù²ÉÓõĻúÖÆ£¬ÉÔºóÎÒÃǾÍÒªÌÖÂÛ¡£

ÔÚ²¢Ðбà³ÌÖУ¬ÓкܶàΪʵ¼ÊÎÊÌâËù¿ª·¢³öµÄ²¢ÐÐËã·¨¡£

ʹÓà MPI ½øÐв¢Ðбà³ÌÀ´ÊµÏÖ¾ØÕóÓëÏòÁ¿µÄ³Ë·¨

ÏÖÔÚÎÒÃÇÒѾ­Á˽âÁ˲¢Ðбà³Ìƽ̨µÄ»ù´¡ÖªÊ¶£¬²¢ÇÒ×¼±¸ºÃÁËÒ»¸ö¼¯Èº£¬½ÓÏÂÀ´¾ÍÒª±àдһ¸ö¿ÉÒԺܺõØÀûÓÃÕâ¸ö¼¯ÈºµÄ³ÌÐò¡£ÎÒÃDz¢²»±àд´«Í³µÄ ¡°hello world¡±£¬¶øÊÇÖ±½ÓÌøµ½Ò»¸öÕæʵµÄÀý×ÓÉÏ£¬²¢±àд»ùÓÚ MPI µÄ³ÌÐòÀ´ÊµÏÖ¾ØÕóÓëÏòÁ¿µÄ³Ë·¨¡£

ÎÒÃǽ«Ê¹ÓÃÔÚ ²¢ÐÐËã·¨ Ò»½ÚÖнéÉܵÄËã·¨À´ºÜºÃµØ½â¾öÕâ¸öÎÊÌâ¡£¼ÙÉèÓÐÒ»¸ö 4X4 µÄ¾ØÕó£¬ÎÒÃÇÏ£Íû½«ÆäÓëÁíÍâÒ»¸ö 4X1 µÄÏòÁ¿½øÐг˷¨²Ù×÷¡£ÎÒÃǽ«¶Ô¾ØÕó³Ë·¨µÄ±ê×¼¼¼ÊõÉÔ΢½øÐÐÒ»ÏÂÐ޸ģ¬ÕâÑù¾Í¿ÉÒÔʹÓÃÇ°Ãæ½éÉܵÄËã·¨ÁË¡£

ÎÒÃDz¢²»¶ÔµÚÒ»ÐÐÓëµÚÒ»ÁнøÐг˷¨²Ù×÷£¬¶øÊǽ«µÚÒ»ÁÐÖеÄËùÓÐÔªËØÓëÏòÁ¿ÖеĵÚÒ»¸öÔªËØÏà³Ë£¬µÚ¶þÁеÄÔªËØÓëÏòÁ¿Öеĵڶþ¸öÔªËØÏà³Ë£¬ÒÀ´ËÀàÍÆ¡£²ÉÓÃÕâÖÖ·½·¨£¬¾Í¿ÉÒԵõ½Ò»¸öÐ嵀 4X4 ¾ØÕó¡£È»ºó£¬½«Ã¿Ò»ÐÐÖеÄËùÓÐ 4 ¸öÔªËØÏà¼Ó£¬µÃµ½Ò»¸ö 4X1 µÄ¾ØÕó£¬Õâ¾ÍÊÇ×îºóµÄ½á¹û¡£

MPI API Óжà¸öº¯Êý¿ÉÒÔÖ±½Ó½â¾öÕâ¸öÎÊÌ⣬ÈçÇåµ¥ 1 Ëùʾ¡£


Çåµ¥ 1. ʹÓà MPI Ö´ÐоØÕó³Ë·¨
/*

To compile: 'mpicc -g -o matrix matrix.c'
To run: 'mpirun -np 4 matrix'

"-np 4" specifies the number of processors.

*/

#include
#include
#define SIZE 4

int main(int argc, char **argv) {
int j;
int rank, size, root;
float X[SIZE];
float X1[SIZE];
float Y1[SIZE];
float Y[SIZE][SIZE];
float Z[SIZE];
float z;
root = 0;
/* Initialize MPI. */
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);

/* Initialize X and Y on root node. Note the row/col alignment. This is specific to C */
if (rank == root) {
Y[0][0] = 1; Y[1][0] = 2; Y[2][0] = 3; Y[3][0] = 4;
Y[0][1] = 5; Y[1][1] = 6; Y[2][1] = 7; Y[3][1] = 8;
Y[0][2] = 9; Y[1][2] = 10;Y[2][2] = 11;Y[3][2] = 12;
Y[0][3] = 13;Y[1][3] = 14;Y[2][3] = 15;Y[3][3] = 16;
Z[0] = 1;
Z[1] = 2;
Z[2] = 3;
Z[3] = 4;
}
MPI_Barrier(MPI_COMM_WORLD);
/* root scatters matrix Y in 'SIZE' parts to all nodes as the matrix Y1 */
MPI_Scatter(Y,SIZE,MPI_FLOAT,Y1,SIZE,MPI_FLOAT,root,MPI_COMM_WORLD);
/* Z is also scattered to all other nodes from root. Since one element is sent to¡¡all nodes, a scalar variable z is used. */
MPI_Scatter(Z,1,MPI_FLOAT,&z,1,MPI_FLOAT, root,MPI_COMM_WORLD);
/* This step is carried out on all nodes in parallel.*/
for(j=0;j X1[j] = z*Y1[j];
}
/* Now rows are added, using MPI_SUM (using recursive halving and doubling algorithm,
internal to the MPI implementation) */
MPI_Reduce(X1,X,SIZE,MPI_FLOAT,MPI_SUM, root,MPI_COMM_WORLD);
if (rank == 0) {
printf("%g\n",X[0]);printf("%g\n",X[1]);printf("%g\n",X[2]);¡¡¡¡¡¡printf("%g\n",X[3]);
}
MPI_Finalize();
return 0;
}






ÐÔÄܲâÊÔ

¼¯ÈºÒѾ­¹¹½¨ºÃ£¬¿ÉÒÔÖ´ÐгÌÐòÁË£¬½ÓÏÂÀ´ÐèÒªÁ˽âÕâЩ³ÌÐòµÄÖ´ÐÐËٶȵ½µ×Óжà¿ì¡£Í¨³£ÎÒÃǶ¼ÈÏΪÊÇ´¦ÀíÆ÷µÄƵÂʾö¶¨ÁËÐÔÄܵĸߵ͡£¶ÔÓÚÌض¨µÄ·¶Î§À´Ëµ£¬Õâ¸ö½áÂÛÊÇÕýÈ·µÄ£»µ«ÊÇÔÚ²»Í¬¹©Ó¦É̵Ĵ¦ÀíÆ÷»òÏàͬ¹©Ó¦ÉÌÌṩµÄ²»Í¬´¦ÀíÆ÷ϵÁÐÖ®¼ä½øÐбȽϣ¬Ã»Ê²Ã´ÒâÒ壬ÒòΪ²»Í¬µÄ´¦ÀíÆ÷ÔÚ¸ø¶¨µÄʱÖÓÖÜÆÚÄÚËùÖ´ÐеÄÈÎÎñÁ¿ÊDz»Í¬µÄ¡£ÔÚ µÚ 1 ²¿·Ö ÖжÔÏòÁ¿ºÍ±êÁ¿´¦ÀíÆ÷½øÐбȽÏʱ£¬ÕâÓÈÆäÃ÷ÏÔ¡£

¶ÔÐÔÄܽøÐбȽϵÄÒ»ÖÖ¸ü¼Ó×ÔÈ»µÄ·½·¨ÊÇÔËÐбê×¼²âÊÔ¡£Ëæ×Åʱ¼äµÄÍÆÒÆ£¬ÓÐÒ»¸ö·Ç³£³öÃûµÄ LINPACK »ù×¼²âÊÔÒѾ­³ÉΪ±È½ÏÐÔÄܵıê×¼¡£ËüÊÇÓÉ Jack Dongarra ÔÚÊ®Äê֮ǰ¿ª·¢µÄ£¬ÏÖÔÚÈÔÔÚÓÉ top500.org ʹÓã¨Çë²ÎÔÄ ²Î¿¼×ÊÁÏ ÖеÄÁ´½Ó£©¡£

Õâ¸ö²âÊÔÒª½â°üº¬ N ¸öÏßÐÔ·½³ÌµÄÃܼ¯·½³Ì×飬ÆäÖи¡µã²Ù×÷µÄ¸öÊýÊÇÒÑÖªµÄ£¨ÊÇ N^3 ¼¶±ð£©¡£Õâ¸ö²âÊԷdz£ÊʺÏÓÃÀ´²âÊÔÄÇЩҪÔËÐпÆѧӦÓóÌÐòºÍÄ£ÄâµÄ¼ÆËã»ú£¬ÒòΪËüÃǶ¼ÒªÔÚijЩ²½ÖèÉÏÊÔͼ¶ÔÏßÐÔ·½³Ì½øÐÐÇó½â¡£

²âÊԵıê×¼µ¥Î»ÊÇÿÃëÖ´Ðеĸ¡µã²Ù×÷ÊýÁ¿£¬¼´ flop Êý£¨ÔÚÕâÖÖÇé¿öÖУ¬flop »òÕßÊÇÒ»¸ö 64 λµÄ¼Ó·¨²Ù×÷£¬»òÕßÊÇÒ»¸ö 64 λµÄ³Ë·¨²Ù×÷£©¡£Õâ¸ö²âÊÔÒª²âÁ¿µÄÄÚÈÝÈçÏ£º

Rpeak£¬flop µÄÀíÂÛ·åÖµ¡£ÔÚ 2005 Äê 6 Ôµı¨¸æÖУ¬IBM Blue Gene/L µÄʱÖÓ·åֵΪ 183.5 tflop£¨ÍòÒÚ flop£©¡£
Nmax£¬µÃ³ö×î¸ß flop ʱËùʹÓõľØÕó´óС N¡£¶ÔÓÚ Blue Gene À´Ëµ£¬Õâ¸öÖµÊÇ 1277951¡£
Rmax£¬Nmax Ëù´ïµ½µÄ×î´ó flop¡£¶ÔÓÚ Blue Gene À´Ëµ£¬Õâ¸öÖµÊÇ 136.8 tflop¡£
ΪÁ˸üºÃµØÀí½âÕâЩÊý×Ö£¬Ç뿼ÂÇÏÂÃæÕâ¸öÊÂʵ£ºIBM BlueGene/L ÔÚ 1 ÃëÖ®ÄÚ¿ÉÒÔÍê³ÉµÄ²Ù×÷ÔÚһ̨¼ÒÓüÆËã»úÉÏÐèÒªÖ´ÐÐ 5 Ìì¡£

ÏÖÔÚÈÃÎÒÃÇÀ´ÌÖÂÛÒ»ÏÂÈçºÎ¶Ô Linux ¼¯Èº½øÐлù×¼²âÊÔ¡£³ýÁË LINPACK Ö®Í⣬ÆäËû»ù×¼²âÊÔ»¹ÓÐ HPC Challenge Benchmark ºÍ NAS benchmark¡£

¶Ô Linux ¼¯Èº½øÐлù×¼²âÊÔ

ÒªÔÚ Linux ¼¯ÈºÉÏÔËÐÐ LINPACK »ù×¼²âÊÔ£¬ÎÒÃÇÐèÒª»ñµÃÒ»¸ö²¢Ðа汾µÄ LINPACK£¬²¢¶ÔÕâ¸ö¼¯ÈºÅäÖà LINPACK¡£ÎÒÃǽ«Ò»²½²½µØ½éÉÜÕû¸ö¹ý³Ì¡£

¾¯¸æ£ºÏÂÃæʹÓÃÁËÆÕͨµÄÏßÐÔ´úÊý¿â£»Ê¹ÓÃËüÖ»ÊÇ×÷Ϊһ¸ö²Î¿¼¡£¶ÔÓÚÒ»¸öÕæÕýµÄ²âÊÔÀ´Ëµ£¬ÒªÊ¹ÓÃÒѾ­Õë¶Ô×Ô¼ºµÄ»·¾³ÓÅ»¯¹ýµÄ¿â¡£

²½Öè 1

´Ó netlib.org

ÖÔ?OSCAR ¿ÉÒÔÖ§³Ö¶à¸ö°æ±¾µÄ Red Hat Linux£»ÓйØÆäËû¿ÉÒÔÖ§³ÖµÄ·¢Ðа汾£¬Çë²ÎÔÄ OSCAR µÄ Web Õ¾µã¡£¸ù¾ÝÔÚÉèÖÃʱËùÅöµ½µÄ´íÎ󣬿ÉÄÜÐèÒª¶Ô¼¸¸ö½Å±¾½øÐÐÐ޸ġ£

ʹÓà OSCAR ´´½¨ Linux ¼¯Èº

ÈÃÎÒÃÇʹÓà OSCAR ×ÊÔ´À´¹¹½¨Ò»¸ö¹¦ÄÜÍ걸µÄ¼¯Èº¡£¼ÙÉèÓÐÁ½¸ö»ò¶à¸öÆÕͨµÄ¹¤×÷Õ¾£¬ËüÃǶ¼Ê¹ÓÃÍøÂçÁ¬½ÓÔÚÒ»Æð¡£½«ÆäÖеÄÒ»¸ö½ÚµãÉèÖÃΪͷ½Úµã£¬ÆäËû½Úµã¶¼ÉèÖÃΪ¼ÆËã½Úµã¡£

ÕýÈçÔÚ¹¹½¨ Linux ¼¯ÈºÊ±Ëù×öµÄÒ»Ñù£¬ÎÒÃÇÒªÏêϸ½éÉÜÔÚÍ·½ÚµãÉÏËùÖ´ÐеIJ½Öè¡£OSCAR ¿ÉÒÔ×Ô¶¯ÅäÖÃÆäËû½Úµã£¬°üÀ¨ OS µÄ°²×°¡££¨Çë²ÎÔÄ OSCAR °²×°Ö¸ÄÏ£»ÏÂÃæÊǶ԰²×°¹ý³ÌµÄ¸ÅÄîÐÔ½éÉÜ¡££©

²½Öè 1

ÔÚÍ·½ÚµãÉÏ°²×° Linux¡£È·±£°²×° X ·þÎñÆ÷¡£

²½Öè 2

mkdir /tftpboot, mkdir /tftpboot/rpm¡£½«°²×°¹âÅÌÖеÄËùÓÐ RPM Îļþ¿½±´µ½Õâ¸öĿ¼ÖС£ÕâЩ RPM ÓÃÀ´´´½¨¿Í»§»úÓ³Ïñ¡£²¢·ÇËùÓÐµÄ RPM ×îÖÕ¶¼ÐèÒª£¬µ«ÊÇ×îºÃÈÃËüÃÇ×Ô¶¯¹¹½¨Õâ¸öÓ³Ïñ¡£

²½Öè 3

È·±£ÒѾ­°²×°²¢ÅäÖÃÁË MySQL£¬²¢ÇÒ¿ÉÒÔ´Ó Perl ÖзÃÎÊ MySQL£¬ÒòΪ OSCAR ½«ËùÓеÄÅäÖÃÐÅÏ¢¶¼±£´æµ½ÁË MySQL ÖУ¬²¢Ê¹Óà Perl À´·ÃÎÊÕâЩÐÅÏ¢¡£Õâ¸ö²½Öèͨ³£ÊÇ¿ÉÑ¡µÄ£¬²¢ÇÒ OSCAR Ò²¿ÉÒÔΪÎÒÃÇÖ´ÐÐÕâЩ²½Ö裬µ«ÊÇÓÐʱÕâ¸ö²½Öè»áʧ°Ü£¬ÓÈÆäÊÇÔÚÒ»¸öÉв»Ö§³ÖµÄ·¢Ðа汾ÉÏ°²×°Ê±¸üÊÇÈç´Ë¡£

²½Öè 4

ÏÂÔØ OSCAR Ô´´úÂë²¢±àÒëËü£º

configure
make install

²½Öè 5

Æô¶¯ OSCAR Ïòµ¼¡£¼ÙÉèÎÒÃÇÏëÒªÕâ¸ö¼¯ÈºÊ¹Óà eth1 À´Á¬½Ó¼¯ÈºÖеĽڵ㣬ÇëʹÓà /opt/oscar/install_cluster eth1¡£

²½Öè 6

ÔÚÕâ¸ö²½ÖèÖУ¬Ò»²½²½µØͨ¹ýËùÓÐµÄ OSCAR ÉèÖÃÆÁÄ»¡£È·±£ÒÔÕýÈ·µÄ˳ÐòÖ´ÐÐÒÔϲ½Ö裺

Ñ¡Ôñ°üÀ´¶¨ÖÆ OSCAR µÄ°²×°¡£Èç¹û²»ÊìϤÕâЩ°ü£¬¿ÉÒÔÔÝʱºöÂÔ¡£


°²×° OSCAR °ü¡£
¹¹½¨¿Í»§»úÓ³Ïñ¡£Õâ¾ÍÊǼÆËã½ÚµãҪʹÓõÄÓ³ÏñÎļþ¡£
¶¨Òå OSCAR ¿Í»§»ú¡£ÕⶨÒåµÄÊǼÆËã½Úµã¡£ÎÒÃÇÐèÒªÖ¸¶¨¼¯ÈºÖÐÏëҪʹÓõĽڵãµÄ¸öÊý£¬ÒÔ¼°ËüÃÇËùʹÓõÄ×ÓÍø¡£Èç¹ûÏÖÔÚ²»È·¶¨Ò»¹²ÓжàÉÙ¸ö½Úµã£¬¿ÉÒÔÉÔºóÔÙÀ´Ð޸ġ£
½«²»Í¬½ÚµãµÄ MAC µØÖ·Ó³ÉäΪ IP µØÖ·¡£¶ÔÓÚÕâ¸ö²½Ö裬ÿ¸ö½Úµã¶¼±ØÐëÔÚ BIOS ÖÐʹÓà PXE ÍøÂçÆô¶¯Ñ¡ÏîÀ´Æô¶¯¡£
²½Öè 7

×îºó£¬ÔËÐвâÊÔ¡£Èç¹ûÒ»ÇÐÔËÐÐÁ¼ºÃ£¬Ã¿¸ö²âÊÔ¶¼Ó¦¸Ã³É¹¦¡£¼´Ê¹Ã»ÓÐÈκÎÎÊÌ⣬ÓÐʱµÚÒ»´Î³¢ÊÔÔËÐÐʱҲ»áÓÐЩ²âÊÔʧ°Ü¡£»¹¿ÉÒÔͨ¹ýÖ´ÐÐ /opt/oscar ÏÂÃæµÄ²âÊԽű¾À´ÊÖ¹¤Ö´ÐÐÕâЩ²âÊÔ¡£

Èç¹ûÎÒÃÇÏÖÔÚÏ£ÍûÌí¼ÓеĽڵ㣬¿ÉÒÔÔÙ´ÎÆô¶¯ OSCAR Ïòµ¼²¢Ìí¼Ó½Úµã¡£OSCAR »áʹÓà PXE ×Ô¶¯½« Linux OS °²×°µ½ÕâЩ½ÚµãÉÏ¡£

ÏÖÔÚÎÒÃÇÒѾ­×¼±¸ºÃ¼¯Èº»·¾³ÁË£¬½ÓÏÂÀ´¿ÉÒÔÔËÐв¢ÐгÌÐòÁË£¬²¢ÇÒ¿ÉÒÔ¸ù¾ÝÐèÒªÌí¼Ó»òɾ³ýнڵ㣬²¢Ê¹Óà Ganglia À´¼àÊÓ½ÚµãµÄ״̬¡£

¹ÜÀí¼¯Èº

µ±ÎÒÃÇÐèÒªÔÚÒ»¸ö¾ßÓдóÁ¿Óû§µÄ²úÆ·»·¾³ÖжԼ¯Èº½øÐйÜÀíʱ£¬×÷Òµµ÷¶ÈºÍ¼àÊӾͱäµÃÓÈÆäÖØÒªÁË¡£

×÷Òµµ÷¶È

MPI ¿ÉÒÔÔÚ¸÷¸ö½ÚµãÉÏÆô¶¯²¢Í£Ö¹½ø³Ì£¬µ«ÊÇÕâÖ»ÄÜÏÞ¶¨ÓÚͬһ¸ö³ÌÐò¡£ÔÚÒ»¸öµäÐ͵ļ¯ÈºÉÏ£¬»áÓкܶàÓû§¶¼ÒªÔËÐÐ×Ô¼ºµÄ³ÌÐò£¬ÎÒÃDZØÐëʹÓõ÷¶ÈÈí¼þÀ´È·±£ËüÃÇ¿ÉÒÔ×îÓŵØʹÓü¯Èº¡£

Ò»¸öÁ÷Ðеĵ÷¶ÈϵͳÊÇ OpenPBS£¬¿ÉÒÔʹÓà OSCAR ×Ô¶¯°²×°Ëü¡£Ê¹ÓÃÕâ¸öµ÷¶Èϵͳ£¬¿ÉÒÔÔÚ¼¯ÈºÉÏ´´½¨×÷Òµ£¬²¢½«×÷ÒµÌá½»µ½¼¯ÈºÉÏÔËÐС£ÔÚ OpenPBS ÖУ¬»¹¿ÉÒÔ´´½¨¸´ÔÓµÄ×÷Òµµ÷¶È²ßÂÔ¡£

ʹÓà OpenPBS »¹¿ÉÒԲ鿴ÕýÔÚÖ´ÐеÄ×÷Òµ¡¢Ìá½»×÷ÒµÒÔ¼°È¡Ïû×÷Òµ¡£Ëü»¹¿ÉÒÔ¿ØÖÆij¸ö×÷Òµ¿ÉÒÔʹÓÃµÄ CPU ʱ¼äµÄ×î´óÖµ£¬Õâ¶ÔÓÚϵͳ¹ÜÀíÔ±À´Ëµ·Ç³£ÓÐÓá£

¼àÊÓ

¼¯Èº¹ÜÀíÖеÄÒ»¸öÖØÒª·½Ãæ¾ÍÊǼàÊÓ£¬ÓÈÆäÊÇÈç¹û¼¯ÈºÖÐÓдóÁ¿µÄ½Úµã¾Í¸üÊÇÈç´Ë¡£´Ë´¦Óм¸ÖÖÑ¡Ôñ£¬ÀýÈç Ganglia£¨OSCAR ¿ÉÒÔÌṩ£©ºÍ Clumon¡£

Ganglia ÓÐÒ»¸ö»ùÓÚ Web µÄÇ°¶Ë½çÃ棬¿ÉÒÔÌṩÓÐ¹Ø CPU ºÍÄÚ´æʹÓÃÇé¿öµÄʵʱ¼àÊÓÐÅÏ¢£»¿ÉÒÔ·½±ãµØ¶ÔÆä½øÐÐÀ©Õ¹£¬Ê¹ÆäÖ»¼àÊÓÓйØijÏîÄÚÈݵÄÐÅÏ¢¡£ÀýÈ磬ʹÓÃһЩ¼òµ¥µÄ½Å±¾£¬ÎÒÃǾͿÉÒÔÈà Ganglia »ã±¨ CPU µÄζȡ¢·çÉÈתËٵȵȡ£ÔÚ½ÓÏÂÀ´µÄ¼¸½ÚÖУ¬ÎÒÃǽ«±àдһЩ²¢ÐгÌÐò£¬²¢ÔÚÕâ¸ö¼¯ÈºÉÏÔËÐÐÕâЩ²¢ÐгÌÐò¡£

²¢ÐÐËã·¨

²¢Ðбà³ÌÓÐ×Ô¼ºµÄһЩ²¢ÐÐËã·¨£¬ËüÃÇ¿ÉÒÔ³ä·ÖÀûÓõײãÓ²¼þµÄÐÔÄÜ¡£½ÓÏÂÀ´ÈÃÎÒÃÇÀ´Á˽âÒ»ÏÂÕâÖÖËã·¨µÄÐÅÏ¢¡£ÈÃÎÒÃǼÙÉèÒ»¸ö½ÚµãÒª¶ÔÒ»×é N ¸öÕûÊý½øÐÐÇóºÍÔËËã¡£ÓÃÆÕͨ·½·¨ÊµÏÖÕâÖÖ²Ù×÷ËùÐèÒªµÄʱ¼äÊÇ O(N)£¨Èç¹û¶Ô 100 ¸öÕûÊý½øÐÐÇóºÍÐèÒª 1ms£¬ÄÇô¶Ô 200 ¸öÕûÊý½øÐÐÇóºÍ¾ÍÐèÒª 2ms£¬ÒÀ´ËÀàÍÆ£©¡£

Õâ¸öÎÊÌâ¿´ÆðÀ´ºÜÄÑÏßÐÔµØÌá¸ßÆäËٶȣ¬µ«ÊÇÖµµÃ×¢ÒâµÄÊÇ£¬µÄÈ·ÓÐÕâÑùÒ»ÖÖ·½·¨¡£ÈÃÎÒÃÇÀ´¿´Ò»¸öÔÚ 4 ¸ö½ÚµãµÄ¼¯ÈºÉÏÖ´ÐгÌÐòµÄÀý×Ó£¬Ã¿¸ö½ÚµãµÄÄÚ´æÖж¼ÓÐÒ»¸öÕûÊý£¬³ÌÐòµÄÄ¿µÄÊǶÔÕâ 4 ¸öÕûÊýÇóºÍ¡£

¿¼ÂÇÏÂÃæµÄ²½Ö裺

½Úµã 2 ½«×Ô¼ºµÄÕûÊý·¢Ë͸ø½Úµã 1£¬½Úµã 4 ½«×Ô¼ºµÄÕûÊý·¢Ë͸ø½Úµã 3¡£ÏÖÔÚ½Úµã 1 ºÍ½Úµã 3 ¶¼ÓÐÁ½¸öÕûÊýÁË¡£
ÕâЩÕûÊýÔÚÕâÁ½¸ö½ÚµãÉÏ·Ö±ð½øÐÐÇóºÍ¡£
½Úµã 3 ½«ËüµÄ²¿·ÖºÍ·¢Ë͸ø½Úµã 1¡£ÏÖÔÚ½Úµã 1 ÓÐÁ½¸ö²¿·ÖºÍÁË¡£
½Úµã 1 ¶ÔÕâЩ²¿·ÖºÍ½øÐÐÇóºÍ£¬´Ó¶øµÃ³ö×îÖÕµÄ×ܺ͡£
ÕýÈçÎÒÃÇ¿ÉÒÔ¿´µ½µÄÒ»Ñù£¬Èç¹û×î³õÓÐ 2N ¸öÊý×Ö£¬ÕâÖÖ·½·¨ÔÚ ~N ¸ö²½ÖèÖоͿÉÒÔʵÏÖÇóºÍÔËËã¡£Òò´ËËã·¨µÄ¸´ÔÓ¶ÈÊÇ O(log2N)£¬ÕâÏà¶ÔÓÚÇ°ÃæµÄ O(N) À´½²ÊÇÒ»¸ö¼«´óµÄ¸Ä½ø¡££¨Èç¹û¶Ô 128 ¸öÊý×Ö½øÐÐÇóºÍÐèÒª 1ms£¬ÄÇôʹÓÃÕâÖÖ·½·¨¶Ô 256 ¸öÊý×Ö½øÐÐÇóºÍ¾ÍÖ»ÐèÒª (8/7) ~ 1.2ms¡£ÔÚÇ°ÃæµÄ·½·¨ÖУ¬ÕâÐèÒª 2ms¡££©

ÕâÖÖ·½·¨ÔÚÿ¸ö²½ÖèÖж¼¿ÉÒÔÊÍ·ÅÒ»°ëµÄ¼ÆËã½Úµã¡£ÕâÖÖË㷨ͨ³£¾Í³ÆΪµÝ¹é¶þ·ÖºÍ±¶Ôö£¨recursive halving and doubling£©·¨£¬Ëü¾ÍÊÇÔÚ MPI ÖÐ reduce º¯Êýµ÷ÓõÄÀà±³ºóËù²ÉÓõĻúÖÆ£¬ÉÔºóÎÒÃǾÍÒªÌÖÂÛ¡£

ÔÚ²¢Ðбà³ÌÖУ¬ÓкܶàΪʵ¼ÊÎÊÌâËù¿ª·¢³öµÄ²¢ÐÐËã·¨¡£

ʹÓà MPI ½øÐв¢Ðбà³ÌÀ´ÊµÏÖ¾ØÕóÓëÏòÁ¿µÄ³Ë·¨

ÏÖÔÚÎÒÃÇÒѾ­Á˽âÁ˲¢Ðбà³Ìƽ̨µÄ»ù´¡ÖªÊ¶£¬²¢ÇÒ×¼±¸ºÃÁËÒ»¸ö¼¯Èº£¬½ÓÏÂÀ´¾ÍÒª±àдһ¸ö¿ÉÒԺܺõØÀûÓÃÕâ¸ö¼¯ÈºµÄ³ÌÐò¡£ÎÒÃDz¢²»±àд´«Í³µÄ ¡°hello world¡±£¬¶øÊÇÖ±½ÓÌøµ½Ò»¸öÕæʵµÄÀý×ÓÉÏ£¬²¢±àд»ùÓÚ MPI µÄ³ÌÐòÀ´ÊµÏÖ¾ØÕóÓëÏòÁ¿µÄ³Ë·¨¡£

ÎÒÃǽ«Ê¹ÓÃÔÚ ²¢ÐÐËã·¨ Ò»½ÚÖнéÉܵÄËã·¨À´ºÜºÃµØ½â¾öÕâ¸öÎÊÌâ¡£¼ÙÉèÓÐÒ»¸ö 4X4 µÄ¾ØÕó£¬ÎÒÃÇÏ£Íû½«ÆäÓëÁíÍâÒ»¸ö 4X1 µÄÏòÁ¿½øÐг˷¨²Ù×÷¡£ÎÒÃǽ«¶Ô¾ØÕó³Ë·¨µÄ±ê×¼¼¼ÊõÉÔ΢½øÐÐÒ»ÏÂÐ޸ģ¬ÕâÑù¾Í¿ÉÒÔʹÓÃÇ°Ãæ½éÉܵÄËã·¨ÁË¡£

ÎÒÃDz¢²»¶ÔµÚÒ»ÐÐÓëµÚÒ»ÁнøÐг˷¨²Ù×÷£¬¶øÊǽ«µÚÒ»ÁÐÖеÄËùÓÐÔªËØÓëÏòÁ¿ÖеĵÚÒ»¸öÔªËØÏà³Ë£¬µÚ¶þÁеÄÔªËØÓëÏòÁ¿Öеĵڶþ¸öÔªËØÏà³Ë£¬ÒÀ´ËÀàÍÆ¡£²ÉÓÃÕâÖÖ·½·¨£¬¾Í¿ÉÒԵõ½Ò»¸öÐ嵀 4X4 ¾ØÕó¡£È»ºó£¬½«Ã¿Ò»ÐÐÖеÄËùÓÐ 4 ¸öÔªËØÏà¼Ó£¬µÃµ½Ò»¸ö 4X1 µÄ¾ØÕó£¬Õâ¾ÍÊÇ×îºóµÄ½á¹û¡£

MPI API Óжà¸öº¯Êý¿ÉÒÔÖ±½Ó½â¾öÕâ¸öÎÊÌ⣬ÈçÇåµ¥ 1 Ëùʾ¡£


Çåµ¥ 1. ʹÓà MPI Ö´ÐоØÕó³Ë·¨
/*

To compile: 'mpicc -g -o matrix matrix.c'
To run: 'mpirun -np 4 matrix'

"-np 4" specifies the number of processors.

*/

#include
#include
#define SIZE 4

int main(int argc, char **argv) {
int j;
int rank, size, root;
float X[SIZE];
float X1[SIZE];
float Y1[SIZE];
float Y[SIZE][SIZE];
float Z[SIZE];
float z;
root = 0;
/* Initialize MPI. */
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);

/* Initialize X and Y on root node. Note the row/col alignment. This is specific to C */
if (rank == root) {
Y[0][0] = 1; Y[1][0] = 2; Y[2][0] = 3; Y[3][0] = 4;
Y[0][1] = 5; Y[1][1] = 6; Y[2][1] = 7; Y[3][1] = 8;
Y[0][2] = 9; Y[1][2] = 10;Y[2][2] = 11;Y[3][2] = 12;
Y[0][3] = 13;Y[1][3] = 14;Y[2][3] = 15;Y[3][3] = 16;
Z[0] = 1;
Z[1] = 2;
Z[2] = 3;
Z[3] = 4;
}
MPI_Barrier(MPI_COMM_WORLD);
/* root scatters matrix Y in 'SIZE' parts to all nodes as the matrix Y1 */
MPI_Scatter(Y,SIZE,MPI_FLOAT,Y1,SIZE,MPI_FLOAT,root,MPI_COMM_WORLD);
/* Z is also scattered to all other nodes from root. Since one element is sent to¡¡all nodes, a scalar variable z is used. */
MPI_Scatter(Z,1,MPI_FLOAT,&z,1,MPI_FLOAT, root,MPI_COMM_WORLD);
/* This step is carried out on all nodes in parallel.*/
for(j=0;j X1[j] = z*Y1[j];
}
/* Now rows are added, using MPI_SUM (using recursive halving and doubling algorithm,
internal to the MPI implementation) */
MPI_Reduce(X1,X,SIZE,MPI_FLOAT,MPI_SUM, root,MPI_COMM_WORLD);
if (rank == 0) {
printf("%g\n",X[0]);printf("%g\n",X[1]);printf("%g\n",X[2]);¡¡¡¡¡¡printf("%g\n",X[3]);
}
MPI_Finalize();
return 0;
}






ÐÔÄܲâÊÔ

¼¯ÈºÒѾ­¹¹½¨ºÃ£¬¿ÉÒÔÖ´ÐгÌÐòÁË£¬½ÓÏÂÀ´ÐèÒªÁ˽âÕâЩ³ÌÐòµÄÖ´ÐÐËٶȵ½µ×Óжà¿ì¡£Í¨³£ÎÒÃǶ¼ÈÏΪÊÇ´¦ÀíÆ÷µÄƵÂʾö¶¨ÁËÐÔÄܵĸߵ͡£¶ÔÓÚÌض¨µÄ·¶Î§À´Ëµ£¬Õâ¸ö½áÂÛÊÇÕýÈ·µÄ£»µ«ÊÇÔÚ²»Í¬¹©Ó¦É̵Ĵ¦ÀíÆ÷»òÏàͬ¹©Ó¦ÉÌÌṩµÄ²»Í¬´¦ÀíÆ÷ϵÁÐÖ®¼ä½øÐбȽϣ¬Ã»Ê²Ã´ÒâÒ壬ÒòΪ²»Í¬µÄ´¦ÀíÆ÷ÔÚ¸ø¶¨µÄʱÖÓÖÜÆÚÄÚËùÖ´ÐеÄÈÎÎñÁ¿ÊDz»Í¬µÄ¡£ÔÚ µÚ 1 ²¿·Ö ÖжÔÏòÁ¿ºÍ±êÁ¿´¦ÀíÆ÷½øÐбȽÏʱ£¬ÕâÓÈÆäÃ÷ÏÔ¡£

¶ÔÐÔÄܽøÐбȽϵÄÒ»ÖÖ¸ü¼Ó×ÔÈ»µÄ·½·¨ÊÇÔËÐбê×¼²âÊÔ¡£Ëæ×Åʱ¼äµÄÍÆÒÆ£¬ÓÐÒ»¸ö·Ç³£³öÃûµÄ LINPACK »ù×¼²âÊÔÒѾ­³ÉΪ±È½ÏÐÔÄܵıê×¼¡£ËüÊÇÓÉ Jack Dongarra ÔÚÊ®Äê֮ǰ¿ª·¢µÄ£¬ÏÖÔÚÈÔÔÚÓÉ top500.org ʹÓã¨Çë²ÎÔÄ ²Î¿¼×ÊÁÏ ÖеÄÁ´½Ó£©¡£

Õâ¸ö²âÊÔÒª½â°üº¬ N ¸öÏßÐÔ·½³ÌµÄÃܼ¯·½³Ì×飬ÆäÖи¡µã²Ù×÷µÄ¸öÊýÊÇÒÑÖªµÄ£¨ÊÇ N^3 ¼¶±ð£©¡£Õâ¸ö²âÊԷdz£ÊʺÏÓÃÀ´²âÊÔÄÇЩҪÔËÐпÆѧӦÓóÌÐòºÍÄ£ÄâµÄ¼ÆËã»ú£¬ÒòΪËüÃǶ¼ÒªÔÚijЩ²½ÖèÉÏÊÔͼ¶ÔÏßÐÔ·½³Ì½øÐÐÇó½â¡£

²âÊԵıê×¼µ¥Î»ÊÇÿÃëÖ´Ðеĸ¡µã²Ù×÷ÊýÁ¿£¬¼´ flop Êý£¨ÔÚÕâÖÖÇé¿öÖУ¬flop »òÕßÊÇÒ»¸ö 64 λµÄ¼Ó·¨²Ù×÷£¬»òÕßÊÇÒ»¸ö 64 λµÄ³Ë·¨²Ù×÷£©¡£Õâ¸ö²âÊÔÒª²âÁ¿µÄÄÚÈÝÈçÏ£º

Rpeak£¬flop µÄÀíÂÛ·åÖµ¡£ÔÚ 2005 Äê 6 Ôµı¨¸æÖУ¬IBM Blue Gene/L µÄʱÖÓ·åֵΪ 183.5 tflop£¨ÍòÒÚ flop£©¡£
Nmax£¬µÃ³ö×î¸ß flop ʱËùʹÓõľØÕó´óС N¡£¶ÔÓÚ Blue Gene À´Ëµ£¬Õâ¸öÖµÊÇ 1277951¡£
Rmax£¬Nmax Ëù´ïµ½µÄ×î´ó flop¡£¶ÔÓÚ Blue Gene À´Ëµ£¬Õâ¸öÖµÊÇ 136.8 tflop¡£
ΪÁ˸üºÃµØÀí½âÕâЩÊý×Ö£¬Ç뿼ÂÇÏÂÃæÕâ¸öÊÂʵ£ºIBM BlueGene/L ÔÚ 1 ÃëÖ®ÄÚ¿ÉÒÔÍê³ÉµÄ²Ù×÷ÔÚһ̨¼ÒÓüÆËã»úÉÏÐèÒªÖ´ÐÐ 5 Ìì¡£

ÏÖÔÚÈÃÎÒÃÇÀ´ÌÖÂÛÒ»ÏÂÈçºÎ¶Ô Linux ¼¯Èº½øÐлù×¼²âÊÔ¡£³ýÁË LINPACK Ö®Í⣬ÆäËû»ù×¼²âÊÔ»¹ÓÐ HPC Challenge Benchmark ºÍ NAS benchmark¡£

¶Ô Linux ¼¯Èº½øÐлù×¼²âÊÔ

ÒªÔÚ Linux ¼¯ÈºÉÏÔËÐÐ LINPACK »ù×¼²âÊÔ£¬ÎÒÃÇÐèÒª»ñµÃÒ»¸ö²¢Ðа汾µÄ LINPACK£¬²¢¶ÔÕâ¸ö¼¯ÈºÅäÖà LINPACK¡£ÎÒÃǽ«Ò»²½²½µØ½éÉÜÕû¸ö¹ý³Ì¡£

¾¯¸æ£ºÏÂÃæʹÓÃÁËÆÕͨµÄÏßÐÔ´úÊý¿â£»Ê¹ÓÃËüÖ»ÊÇ×÷Ϊһ¸ö²Î¿¼¡£¶ÔÓÚÒ»¸öÕæÕýµÄ²âÊÔÀ´Ëµ£¬ÒªÊ¹ÓÃÒѾ­Õë¶Ô×Ô¼ºµÄ»·¾³ÓÅ»¯¹ýµÄ¿â¡£

²½Öè 1

´Ó netlib.org ÏÂÔØ hpl.tgz£¬ÕâÊÇ LINPACK »ù×¼²âÊԵIJ¢ÐУ¨MPI£©°æ±¾£¨Çë²ÎÔÄ ²Î¿¼×ÊÁÏ ÖеÄÁ´½Ó£©¡£

²½Öè 2

´Ó netlib.org ÏÂÔØ blas_linux.tgz£¬ÕâÊÇÔ¤ÏȱàÒëºÃµÄ BLAS£¨Basic Linear Algebra Subprograms£©¡£ÎªÁ˼òµ¥Æð¼û£¬¿ÉÒÔʹÓÃÒ»¸öΪ Linux ×¼±¸µÄÔ¤ÏȱàÒëºÃµÄ BLAS ²Î¿¼ÊµÏÖ£¬µ«ÊÇΪÁËÄܹ»µÃµ½¸üºÃµÄ½á¹û£¬Ó¦¸ÃʹÓÃÓ²¼þ¹©Ó¦ÉÌËùÌṩµÄ BLAS£¬»òÕßʹÓÿª·ÅÔ´ÂëµÄ ATLAS ÏîÄ¿½øÐÐ×Ô¶¯ÓÅ»¯¡£

²½Öè 3

mkdir /home/linpack; cd /home/linpack£¨ÎÒÃÇÒª½«ËùÓеĶ«Î÷¶¼°²×°µ½ /home ÖУ©¡£

²½Öè 4

½âѹ²¢Õ¹¿ª blas_linux.tgz£¬ÕâÑùÓ¦¸Ã»áµÃµ½Ò»¸öÃûΪ blas_linux.a µÄÎļþ¡£Èç¹û¿´µ½ÁËÕâ¸öÎļþ£¬¾Í¿ÉÒÔºöÂÔËù¿´µ½µÄ´íÎó¡£

²½Öè 5

½âѹ²¢Õ¹¿ª hpl.tgz£¬ÕâÑùÓ¦¸Ã»áµÃµ½Ò»¸öĿ¼ hpl¡£

²½Öè 6

½«ËùÓеÄÅäÖÃÎļþ£¨ÀýÈç Make.Linux_PII_FBLAS£©´Ó hpl/setup ¿½±´µ½ hpl Ŀ¼ÖУ¬²¢½« hpl ÖеĿ½±´ÖØÃüÃûΪ Make.LinuxGeneric¡£

²½Öè 7

±à¼­Îļþ Make.LinuxGeneric ÖÐÏÂÃæµÄÄÚÈÝ£¬²¢ÐÞ¸ÄΪÊʺÏÄúµÄ»·¾³µÄÖµ£º

TOPdir = /home/linpack/hpl
MPdir = /tmp/mpich-1.2.6
LAlib = /home/linpack/blas_linux.a
CC = /tmp/mpich-1.2.6/bin/mpicc
LINKER = /tmp/mpich-1.2.6/bin/mpif77

Õâ 5 ¸öµØ·½Ö¸Ã÷Á˲½Öè 1 ÖÐ LINPACK µÄ¶¥¼¶Ä¿Â¼¡¢MPICH °²×°µÄ¶¥¼¶Ä¿Â¼ÒÔ¼°²½Öè 2 ÖÐ BLAS ²Î¿¼ÊµÏÖµÄλÖá£

²½Öè 8

ÏÖÔÚ±àÒë HPL£º

make arch=LinuxGeneric

Èç¹ûûÓдíÎ󣬾ͻáµÃµ½Á½¸öÎļþ xhpl ºÍ HPL.dat£¬ËüÃǶ¼ÔÚ /home/linpack/hpl/bin/LinuxGeneric Ŀ¼ÖС£

²½Öè 9

ÔÚ¼¯ÈºÉÏÔËÐÐ LINPACK »ù×¼²âÊÔ֮ǰ£¬½«Õû¸ö /home/linpack Ŀ¼¿½±´µ½¼¯ÈºÖеÄËùÓлúÆ÷ÉÏ¡££¨Èç¹ûʹÓà OSCAR ´´½¨µÄ¼¯Èº²¢ÅäÖÃÁË NFS ¹²Ïí£¬¾Í¿ÉÒÔºöÂÔÕâ¸ö²½Öè¡££©

ÏÖÔÚ cd µ½ÔÚ²½Öè 8 ÖÐËù´´½¨µÄ¿ÉÖ´ÐгÌÐòËùÔÚµÄĿ¼£¬²¢ÔËÐÐһЩ²âÊÔ£¨ÀýÈç /tmp/mpich-1.2.6/bin/mpicc -np 4 xhpl£©¡£Ó¦¸Ã»á¿´µ½Ê¹Óà GFLOP ±íʾµÄÖ´Ðнá¹û¡£

×¢£ºÉÏÃæµÄ²½Öè»á»ùÓÚ¾ØÕó´óСµÄȱʡÉèÖÃÀ´ÔËÐÐһЩ±ê×¼²âÊÔ¡£Ê¹ÓÃÎļþ HPL.dat À´¶Ô²âÊÔ½øÐе÷ÓÅ¡£Óйص÷ÓŵÄÏêϸÐÅÏ¢¿ÉÒÔÔÚÎļþ /home/linpack/hpl/TUNING ÖÐÕÒµ½¡£

IBM Blue Gene/L

ÏÖÔÚÎÒÃÇÒѾ­¹¹½¨ºÃÁ˼¯Èº£¬½ÓÏÂÀ´¿ìËÙ½éÉÜһϠBlue Gene/L£¬ÕâÊÇһ̨»ùÓÚ¼¯ÈºµÄ·Ç³£ºÃµÄ³¬¼¶¼ÆËã»ú¡£Blue Gene/L ÊÇÒ»Ïî´óÐ͵Ť³Ì׳¾Ù£¬¶ÔÆä½øÐÐÏêϸ½éÉÜÏÔÈ»ÒѾ­³¬³öÁ˱¾Îĵķ¶Î§¡£ÏÖÔÚÎÒÃÇÖ»ÊǼòµ¥½éÉÜһϱíÃæµÄ¶«Î÷¡£

ÈýÄêÇ°£¬µØÇòÄ£ÄâÆ÷£¨Earth Simulator£©£¨ÏòÁ¿´¦ÀíÆ÷£©³ÉΪÊÀ½çÉÏ×î¿ìµÄ¼ÆËã»ú£¬ºÜ¶àÈ˶¼Ô¤²â¼¯Èº×÷ΪһÖÖ³¬¼¶¼ÆËã»úƽ̨ÒѾ­×ßÏòÁËËÀÍö£¬ÏòÁ¿´¦ÀíÆ÷ÒѾ­¸´ËÕÁË£»Õâ¸ö½áÂÛϵÃÌ«ÔçÁË¡£Blue Gene/L ÔÚ±ê×¼µÄ LINPACK »ù×¼²âÊÔÖÐÒѾ­³¹µ×»÷°ÜÁ˵ØÇòÄ£ÄâÆ÷¡£

Blue Gene/L ²¢²»ÊÇʹÓó£ÓõŤ×÷Õ¾À´¹¹½¨µÄ£¬µ«ÊÇËüÒÀȻʹÓñ¾ÏµÁÐÎÄÕÂÖÐËùÌÖÂ۵ıê×¼¼¯Èº¼¼Êõ¡£ËüʹÓÃÁËÒ»¸öÔ´×ÔÓÚ±¾ÎÄÖÐʹÓÃµÄ MPICH µÄ MPI ʵÏÖ¡£Ëü»¹¿ÉÒÔÔËÐÐ 700MHz µÄ±ê×¼ 32 λ PowerPC® CPU£¨²»¹ýÕâЩÊÇ»ùÓÚƬÉÏϵͳ»ò SoC ¼¼ÊõµÄ£©£¬Õâ±È¸ÃϵÁÐÖеÄÆäËû»úÆ÷¸üÄܼ«´óµØ½µµÍ¶ÔÖÆÀäºÍµçÔ´µÄÐèÇó¡£

Blue Gene/L ÊÇÒ»¸ö·Ç³£´óµÄ»úÆ÷£¬ÓÐ 65,536 ¸ö¼ÆËã½Úµã£¨Ã¿¸ö½Úµã¶¼ÔËÐÐÒ»¸ö¶¨ÖƵIJÙ×÷ϵͳ£©£¬»¹ÓÐ 1,024 ¸öרÓÃµÄ I/O ½Úµã£¨ÔËÐÐ Linux Äںˣ©¡£Ê¹ÓÃÈç´Ë¶àµÄ½Úµã£¬ÍøÂç¾ÍÓÈÆäÖØÒªÁË£¬Blue Gene/L ¿ÉÒÔʹÓà 5 ÖÖ²»Í¬ÀàÐ͵ÄÍøÂ磬ÿÖÖÍøÂ綼Ϊһ¸öÌض¨µÄÄ¿µÄ½øÐÐÁËÓÅ»¯¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ