Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,15 @@
"repo_url": "https://github.com/CEED/Laghos.git",
"branch": None,
"commit_id": "a7f6123d42847f6bdbdb614f5af876541f49cd16"
},
"ADEPT": {
"repo_url": "https://github.com/mgawan/ADEPT.git",
"branch": "hip",
"commit_id": "824165fba3073399130455dec943405fe983cab5"
},
"LocalAsmHashTbl": {
"repo_url": "https://github.com/mgawan/gpu_local_ht.git",
"branch": "hip",
"commit_id": "5bf9b6052fb63f7509797b48860818c0702df7e1"
}
}
147 changes: 147 additions & 0 deletions src/hiptestsuite/applications/hpc_apps/LocalAssemblyHashTable/laht.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023 Intel Finland Oy. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from hiptestsuite.TesterRepository import Tester, Test, TestData
from hiptestsuite.Test import HIPTestData, TestResult, HIP_PLATFORM
from typing import Union, List
from hiptestsuite.test_classifier import TestClassifier
from hiptestsuite.applications.hpc_apps.LocalAssemblyHashTable.laht_build_amd import BuildRunAmd
from hiptestsuite.common.hip_get_packages import HipPackages

import os

# Common class to clone, set up, build and run test
class PrepareTest():
def __init__(self, cwd):
self.cwdAbs = cwd
self.app_path = os.path.join(
self.cwdAbs, "src/hiptestsuite/applications/hpc_apps",
"LocalAssemblyHashTable/")
self.repo_dir = os.path.join(self.app_path, "gpu_local_ht/")
self.prepareobj = None
self.apprepo = "" # Default
self.appbranch = ""
self.appcommitId = ""

def set_laht_repoinfo(self, test_data: HIPTestData):
validrepconfig = True
if test_data.repos["LocalAsmHashTbl"].repo_url != None:
self.apprepo = test_data.repos["LocalAsmHashTbl"].repo_url
else:
validrepconfig &= False
if test_data.repos["LocalAsmHashTbl"].branch != None:
self.appbranch = test_data.repos["LocalAsmHashTbl"].branch
if test_data.repos["LocalAsmHashTbl"].commit_id != None:
self.appcommitId = test_data.repos["LocalAsmHashTbl"].commit_id
return validrepconfig

def downloadtest(self, logFile, test_data: HIPTestData):
return HipPackages().pull_repo(logFile, self.apprepo, self.appbranch,
self.appcommitId, "LocalAsmHashTbl")

def buildtest(self, logFile, platform):
if platform == HIP_PLATFORM.amd:
self.prepareobj = BuildRunAmd(self.repo_dir, logFile)
buildstatus = self.prepareobj.buildtest()
return buildstatus == True

print("Invalid Platform")
return False

def clean(self):
if self.prepareobj != None:
self.prepareobj.clean()

def runtest(self, testnum):
if self.prepareobj != None:
self.prepareobj.runtest(testnum)

def parse_result(self, testnum):
if self.prepareobj != None:
return self.prepareobj.parse_result(testnum)
return False

class LAHT(TestClassifier):
def __init__(self):
TestClassifier.__init__(self)

def add_matched_with_names(self,
matched_with_names: Union[None, dict] = None):
TestClassifier.add_matched_with_names(
self, {"LocalAsmHashTbl": matched_with_names})

class MINIAPP(LAHT):
def __init__(self):
LAHT.__init__(self)

def add_matched_with_names(self,
matched_with_names: Union[None, dict] = None):
LAHT.add_matched_with_names(self, {"mini-app": matched_with_names})

# Local Assembly Hash Table Unit/Regression Test
class LAHT_UNIT_TEST(Tester, PrepareTest):
def __init__(self):
Tester.__init__(self)
self.cwd = os.getcwd()
PrepareTest.__init__(self, self.cwd)

def getTests(self) -> List[Test]:
test = Test()
test.test_name = self.__class__.__name__
classifier = MINIAPP()
classifier.add_matched_with_names()
test.classifiers = [classifier]
test.tester = self
return [test]

def clean(self):
PrepareTest.clean(self)

def test(self, test_data: HIPTestData):
print("=============== Local Assembly Hash Table Unit test",
"===============")
if test_data.HIP_PLATFORM != HIP_PLATFORM.amd:
print("Local Assembly Hash Table test is not supported on the "
"requested platform")
test_data.test_result = TestResult.SKIP
return
# Set repo info
if not self.set_laht_repoinfo(test_data):
test_data.test_result = TestResult.ERROR
return
# Create the log directory
resultLogDir = test_data.log_location
with open(resultLogDir + "/laht_unit.log", 'w+') as testLogger:
res = self.downloadtest(testLogger, test_data)
if not res:
test_data.test_result = TestResult.FAIL
return
res = self.buildtest(testLogger, test_data.HIP_PLATFORM)
if not res:
test_data.test_result = TestResult.FAIL
return
self.runtest(0)
# Parse the test result
if True == self.parse_result(0):
test_data.test_result = TestResult.PASS
else:
test_data.test_result = TestResult.FAIL

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023 Intel Finland Oy. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from hiptestsuite.common.hip_shell import *
from hiptestsuite.applications.hpc_apps.LocalAssemblyHashTable.laht_parser_common import (
LAHTParser
)

import os
import tempfile
from multiprocessing import cpu_count

class BuildRunAmd():
def __init__(self, repo_dir, logFile):
self.repo_dir = repo_dir
self.logFile = logFile
self.runlog = None
self.rocm_path = os.environ.get('ROCM_PATH')
if not self.rocm_path:
self.rocm_path = "/opt/rocm"


def buildtest(self):
if not os.path.exists(self.rocm_path):
print("Error: ROCm path does not exist. Exiting Test!")
print("NOTE: tried path '{}'".format(self.rocm_path))
return False
return True # Nothing to build here.

def runtest(self, testnum):
print("Running Local Assembly Hash Table Test..")
env = os.environ.copy()
env['PATH'] = self.rocm_path + '/bin:' + env['PATH']
cmd = """
set -e
cd {repo_dir}/src
mkdir -p build
bash test_script.sh
""".format(repo_dir=self.repo_dir)
self.runlog = tempfile.TemporaryFile("w+")
execshellcmd_largedump(cmd, self.logFile, self.runlog, env)

def clean(self):
print("Cleaning Local Assembly Hash Table..")
if self.runlog != None:
self.runlog.close()

def parse_result(self, testnum):
return LAHTParser(self.runlog).parse(testnum)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import re

class LAHTParser():
def __init__(self, results):
results.seek(0)
self.results = results.read()

def parse(self, testnum):
fail_count = self.results.count("FAILED!")
pass_count = self.results.count("PASSED!")
return fail_count == 0 and pass_count >= 4
Empty file.
Loading