@@ -744,28 +744,59 @@ def list_toolchains_rst(tcs):
744744 """ Returns overview of all toolchains in rst format """
745745 title = "List of known toolchains"
746746
747- # figure out column names
748- table_titles = ['name' , 'compiler' , 'MPI' ]
749- for tc in tcs .values ():
750- table_titles .extend (tc .keys ())
747+ # Specify the column names for the table
748+ table_titles = ['NAME' , 'COMPILER' , 'MPI' , 'LINALG' , 'FFT' ]
751749
750+ # Set up column name : display name pairs
752751 col_names = {
753- 'COMPILER_CUDA' : 'CUDA compiler' ,
754- 'SCALAPACK' : 'ScaLAPACK' ,
752+ 'NAME' : 'Name' ,
753+ 'COMPILER' : 'Compiler(s)' ,
754+ 'LINALG' : "Linear algebra" ,
755755 }
756756
757- table_titles = nub (table_titles )
757+ # Create sorted list of toolchain names
758+ sorted_tc_names = sorted (tcs .keys (), key = str .lower )
758759
759- table_values = [[] for i in range ( len ( table_titles ))]
760- table_values [ 0 ] = [ '**%s**' % tcname for tcname in tcs . keys ()]
760+ # Create text placeholder to use for missing entries
761+ none_txt = '*(none)*'
761762
762- for idx in range (1 , len (table_titles )):
763- for tc in tcs .values ():
764- table_values [idx ].append (', ' .join (tc .get (table_titles [idx ].upper (), [])))
763+ # Initialize an empty list of lists for the table data
764+ table_values = [[] for i in range (len (table_titles ))]
765765
766+ for col_id , col_name in enumerate (table_titles ):
767+ if col_name == 'NAME' :
768+ # toolchain names column gets bold face entry
769+ table_values [col_id ] = ['**%s**' % tcname for tcname in sorted_tc_names ]
770+ else :
771+ for tc_name in sorted_tc_names :
772+ tc = tcs [tc_name ]
773+ if 'cray' in tc_name .lower ():
774+ if col_name == 'COMPILER' :
775+ entry = ', ' .join (tc [col_name .upper ()])
776+ elif col_name == 'MPI' :
777+ entry = 'cray-mpich'
778+ elif col_name == 'LINALG' :
779+ entry = 'cray-libsci'
780+ # Combine the linear algebra libraries into a single column
781+ elif col_name == 'LINALG' :
782+ linalg = []
783+ for col in ['BLAS' , 'LAPACK' , 'SCALAPACK' ]:
784+ linalg .extend (tc .get (col , []))
785+ entry = ', ' .join (nub (linalg )) or none_txt
786+ else :
787+ # for other columns, we can grab the values via 'tc'
788+ # key = col_name
789+ entry = ', ' .join (tc .get (col_name , [])) or none_txt
790+ table_values [col_id ].append (entry )
791+
792+ # Set the table titles to the pretty ones
766793 table_titles = [col_names .get (col , col ) for col in table_titles ]
794+
795+ # Pass the data to the rst formatter, wich is returned as a list, each element
796+ # is an rst formatted text row.
767797 doc = rst_title_and_table (title , table_titles , table_values )
768798
799+ # Make a string with line endings suitable to write to document file
769800 return '\n ' .join (doc )
770801
771802
0 commit comments