@@ -40,7 +40,7 @@ global processor_dict = merge(processor_dict_amd, processor_dict_intel)
4040global accelerator_dict = merge (accelerator_dict_intel, accelerator_dict_amd, accelerator_dict_nvidia)
4141
4242function get_info_dict (idtype)
43- command = ` sudo lshw -xml -C $idtype `
43+ command = ` sudo lshw -xml -quiet - C $idtype `
4444 xmlinfo = read (command, String)
4545 xml_dict (xmlinfo)
4646end
@@ -400,11 +400,40 @@ end
400400end
401401=#
402402
403+ function collectProcessorFeaturesDefault ()
404+
405+ processor_features = Dict ()
406+
407+ processor_features[" processor_count" ] = 1
408+ processor_features[" processor_core_count" ] = 1
409+ processor_features[" processor_core_threads_count" ] = 1
410+ processor_features[" processor_core_clock" ] = " unset"
411+ processor_features[" processor_simd" ] = " unset"
412+ processor_features[" processor_core_L1_size" ] = " unset"
413+ processor_features[" processor_core_L2_size" ] = " unset"
414+ processor_features[" processor_L3_size" ] = " unset"
415+ processor_features[" processor_manufacturer" ] = " unset"
416+ processor_features[" processor_tdp" ] = " unset"
417+ processor_features[" processor" ] = " unset"
418+
419+ return processor_features
420+
421+ end
422+
403423# using CpuId (safe)
404424
405425function identifyProcessor ()
406-
407- collectProcessorFeatures_CpuId ()
426+ try
427+ processor_features = collectProcessorFeatures_CpuId ()
428+ println (stderr , " ok" )
429+ return processor_features
430+ catch error
431+ println (stderr , " fail." )
432+ println (stderr , " => Error: detecting processor features failed. Using default features." )
433+ println (stderr , " You can setup processor features manually." )
434+ println (stderr , error)
435+ return collectProcessorFeaturesDefault ()
436+ end
408437
409438#=
410439 l = Vector()
@@ -464,13 +493,40 @@ function collectAcceleratorFeatures(l)
464493 return i == 2 ? accelerator_features[" 1" ] : accelerator_features
465494end
466495
496+ function collectAcceleratorFeaturesDefault ()
497+
498+ default_features = Dict ()
499+
500+ default_features[" accelerator_count" ] = 0
501+ default_features[" accelerator" ] = " unset"
502+ default_features[" accelerator_type" ] = " unset"
503+ default_features[" accelerator_manufacturer" ] = " unset"
504+ default_features[" accelerator_api" ] = " unset"
505+ default_features[" accelerator_architecture" ] = " unset"
506+ default_features[" accelerator_memorysize" ] = " unset"
507+ default_features[" accelerator_tdp" ] = " unset"
508+
509+ return default_features
510+ end
511+
467512function identifyAccelerator ()
468- l = Vector ()
469- for d in identifyComponent (" display" )
470- push! (l,d[" vendor" ] * " " * d[" product" ])
471- end
513+ try
514+
515+ l = Vector ()
516+ for d in identifyComponent (" display" )
517+ push! (l,d[" vendor" ] * " " * d[" product" ])
518+ end
472519
473- collectAcceleratorFeatures (l)
520+ accelerator_features = collectAcceleratorFeatures (l)
521+ println (stderr , " ok" )
522+ return accelerator_features
523+ catch error
524+ println (stderr , " fail." )
525+ println (stderr , " => Error: detecting accelerator features failed. Using default features." )
526+ println (stderr , " You can setup accelerator features manually." )
527+ println (stderr , error)
528+ return collectAcceleratorFeaturesDefault ()
529+ end
474530end
475531
476532#=
@@ -580,11 +636,15 @@ function identifyMemory()
580636 end
581637 end
582638 end
583-
584- return collectMemoryFeatures (d1)
639+
640+ memory_features = collectMemoryFeatures (d1)
641+ println (stderr , " ok" )
642+ return memory_features
585643
586644 catch error
587- println (stderr , " Error fetching memory info. Loading default values." )
645+ println (stderr , " fail." )
646+ println (stderr , " => Error: detecting primary memory features failed. Using default features." )
647+ println (stderr , " You can setup primary memory features manually." )
588648 println (stderr ,error)
589649 return collectMemoryFeaturesDefault ()
590650 end
@@ -638,7 +698,9 @@ function identifyStorage()
638698 end
639699 end
640700 catch error
641- println (stderr , " Error fetching storage info. Loading default values." )
701+ println (stderr , " fail." )
702+ println (stderr , " => Error: detection of storage features failed. Using default features." )
703+ println (stderr , " You can setup storage features manually." )
642704 println (stderr , error)
643705
644706 # default
656718# TODO
657719function identityInterconnection ()
658720
659- println (" NOTE: The identification of interconnection features is not yet implemented. Using defaults." )
721+ println (stderr , " fail." )
722+ println (stderr , " => Note: detection of interconnection features (cluster computing) not yet implemented. Using default features. You can setup manually." )
723+ println (stderr , " You can setup interconnection features manually." )
660724
661725 interconnection_features = Dict ()
662726
@@ -673,14 +737,16 @@ end
673737# TODO
674738function identifyNode ()
675739
676- println (" NOTE: The identification of node features is not yet implemented. Using defaults." )
740+ println (stderr , " fail." )
741+ println (stderr , " => Note: detection of node features (cluster and cloud computing) not yet implemented. Using default features." )
742+ println (stderr , " You can setup node features manually." )
677743
678744 interconnection_features = Dict ()
679745
680746 interconnection_features[" node_count" ] = 1
681747 interconnection_features[" node_provider" ] = " OnPremise"
682748 interconnection_features[" node_virtual" ] = " No"
683- interconnection_features[" node_virtual " ] = " Yes "
749+ interconnection_features[" node_dedicated " ] = " No "
684750 interconnection_features[" node_machinefamily" ] = " unset"
685751 interconnection_features[" node_machinetype" ] = " unset"
686752 interconnection_features[" node_machinesize" ] = " unset"
@@ -716,12 +782,12 @@ end
716782
717783function setup ()
718784
719- print (" indentifying node... " ); node_features = identifyNode (); println ( stderr , " ok " )
720- print (" indentifying processor... " ); processor_features = identifyProcessor (); println ( stderr , " ok " )
721- print (" indentifying accelerator... " ); accelerator_features = identifyAccelerator (); println ( stderr , " ok " )
722- print (" indentifying memory... " ); memory_features = identifyMemory (); println ( stderr , " ok " )
723- print (" indentifying storage... " ); storage_features = identifyStorage (); println ( stderr , " ok " )
724- print (" indentifying interconnection... " ); interconnection_features = identityInterconnection (); println ( stderr , " ok " )
785+ print (" identifying node... " ); node_features = identifyNode ()
786+ print (" identifying processor... " ); processor_features = identifyProcessor ()
787+ print (" identifying accelerator... " ); accelerator_features = identifyAccelerator ()
788+ print (" identifying memory... " ); memory_features = identifyMemory ()
789+ print (" identifying storage... " ); storage_features = identifyStorage ()
790+ print (" identifying interconnection... " ); interconnection_features = identityInterconnection ()
725791
726792 platform_features = Dict ()
727793
@@ -749,12 +815,12 @@ function setup()
749815 println (" Platform.toml will be searched in the following locations:" )
750816 println (" 1) A file path pointed by a PLATFORM_DESCRIPTION environment variable;" )
751817 println (" 2) The current directory;" )
752- println (" 3) The /etc/conf directory." )
818+ println (" 3) The /etc directory." )
753819 else
754820 TOML. print (stdout , platform_features)
755821 println (stderr )
756- println (stderr , " Platform description file already exists in the current folder (Platform.toml)" )
757- println (stderr , " You must erase or move it before to create a new one." )
822+ println (stderr , " Platform description file already exists in the current folder (Platform.toml). " )
823+ println (stderr , " You must delete or move it before creating a new one." )
758824 end
759825
760826end
0 commit comments