Commit 7d0b4c7d authored by Youngsung Kim's avatar Youngsung Kim Committed by Kim, Youngsung
Browse files

Adds automatic machine detection; updates machine config & docs

* added machine detection for Frontier, Perlmutter(GPU and CPU), Aurora,
  HPC11(Miller and Arch)
* updated machine configurations to date
* updated documentation
* copied third-party licences in licenses directory
* minor update in the format of LICENSE file
parent d170be16
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # minimum CMake version to supp

set(TRITON_EXECUTABLE "triton.exe")

find_package(Python3 COMPONENTS Interpreter REQUIRED)

# put these before project(...)
include(cmake/util.cmake)
include(cmake/machine.cmake)
@@ -10,6 +12,8 @@ set_environment()

project(triton CXX)
set(CMAKE_CXX_STANDARD 17) # minimum C++ standard to support Kokkos
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

message(STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")

@@ -40,7 +44,6 @@ add_build_and_run_scripts()

# add tests
if(${BUILD_TESTS})
  find_package(Python3 COMPONENTS Interpreter REQUIRED)
  enable_testing()
  add_subdirectory(${TRITON_SOURCE_DIR}/test)
  add_test_script()
+29 −6
Original line number Diff line number Diff line
•	Copyright (c) 2019, UT-Battelle, LLC and Tennessee Technological University. All rights reserved. 
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1.  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
TRITON Software License

Copyright (c) 2019-present, UT-Battelle, LLC and Tennessee Technological University.
All rights reserved. 

Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:

1.  Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors maybe
used to endorse or promote products derived from this software without specific prior
written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
+3 −1
Original line number Diff line number Diff line
@@ -102,7 +102,9 @@ We welcome contributions!

## License

TRITON is released under the **3-Clause BSD License**. See [LICENSE](LICENSE) for more details.
TRITON is released under the **3-Clause BSD License**. See the [LICENSE](LICENSE) file for full terms and conditions.

External third-party libraries included or referenced by TRITON retain their own respective licenses, which are provided in the **licenses** subdirectory.

## Acknowledgments

+96 −0
Original line number Diff line number Diff line
@@ -28,9 +28,105 @@ if(EXISTS "${MACHINE}")
  set(machinefile_path "${MACHINE}")

else()

  if("${MACHINE}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}")
    set(MACHINES_DIR "${TRITON_SOURCE_DIR}/cmake/machines")
    
    # Get all sub-directories
    file(GLOB SUBDIRS "${MACHINES_DIR}/*")
    
    set(MATCHED_MACHINE "")
    set(HOST_FQDN "")
    
    # Use Python to get FQDN
    execute_process(
      COMMAND python3 -c "import socket; print(socket.getfqdn())"
      OUTPUT_VARIABLE HOST_FQDN
      OUTPUT_STRIP_TRAILING_WHITESPACE
    )
    message(STATUS "Detected FQDN: ${HOST_FQDN}")
    
	# Iterate through subdirectories
	set(MATCHED_MACHINES "")  # List of all matched machine names

	foreach(subdir ${SUBDIRS})
	  if(IS_DIRECTORY "${subdir}")
        get_filename_component(LAST_DIR_NAME "${subdir}" NAME)
		set(machine_cmake "${subdir}/__machine__.cmake")

		if(EXISTS "${machine_cmake}")
		  unset(FQDN_REGEX)
		  unset(ENV_VALUES)

		  # Include the CMake file so that FQDN_REGEX and MACHINE_NAME are set
		  include("${machine_cmake}")

		  if(DEFINED FQDN_REGEX)
			string(REGEX MATCH "${FQDN_REGEX}" _match "${HOST_FQDN}")

			if(_match)
		      if(DEFINED ENV_VALUES)
				set(ALL_ENV_MATCH TRUE)  # assume all match until proven otherwise

				# Split multiple key:value pairs by comma
				string(REPLACE "," ";" ENV_PAIRS "${ENV_VALUES}")

				foreach(pair ${ENV_PAIRS})
					# Split into key and expected value
					string(REPLACE ":" ";" ENV_PARTS "${pair}")
					list(GET ENV_PARTS 0 ENV_KEY)
					list(GET ENV_PARTS 1 EXPECTED_VALUE)

					# Get actual environment variable value
					set(ACTUAL_VALUE $ENV{${ENV_KEY}})
					DEBUG_MESSAGE("ENV_KEY = ${ENV_KEY}, EXPECTED_VALUE =
						${EXPECTED_VALUE}, ACTUAL_VALUE = ${ACTUAL_VALUE}")

					if(DEFINED ENV{${ENV_KEY}})
						if(NOT ACTUAL_VALUE STREQUAL EXPECTED_VALUE)
							set(ALL_ENV_MATCH FALSE)
						endif()
					else()
						set(ALL_ENV_MATCH FALSE)
					endif()
				endforeach()

				# If all key:value pairs matched, record this machine
				if(ALL_ENV_MATCH)
                    list(APPEND MATCHED_MACHINES "${LAST_DIR_NAME}")
                    message(STATUS "Matched ENV: ${ENV_VALUES}")
				endif()
              else()
			    list(APPEND MATCHED_MACHINES "${LAST_DIR_NAME}")
			    message(STATUS "Matched regex: ${FQDN_REGEX}")
              endif()
			endif()
		  else()
			message(WARNING " - FQDN_REGEX not defined in ${machine_cmake}")
		  endif()
		endif()
	  endif()
	endforeach()

	# Handle number of matches
	list(LENGTH MATCHED_MACHINES MATCH_COUNT)

	if(MATCH_COUNT EQUAL 1)
	  list(GET MATCHED_MACHINES 0 MACHINE)
	  message(STATUS "Matched machine: ${MACHINE}")
	elseif(MATCH_COUNT GREATER 1)
	  message(FATAL_ERROR
	    "Multiple matches found (${MATCH_COUNT}): ${MATCHED_MACHINES}.
	     Use -DMACHINE=<machine name or path> cmake command-line argument"
	  )
	endif()
  endif()

  file(GLOB_RECURSE ALL_FILES "${TRITON_SOURCE_DIR}/cmake/machines/${MACHINE}/*")
  set(machinefile_name "${COMPILER_NICKNAME}_${BACKEND}")
  
  DEBUG_MESSAGE("machinefile_name = ${machinefile_name}")

  foreach(f ${ALL_FILES})
    # Get the filename without the directory
    get_filename_component(fname "${f}" NAME_WLE)
+1 −0
Original line number Diff line number Diff line
set(FQDN_REGEX "arch.*afw\.ccs.*")
Loading