-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #298 from mlcommons/mlperf-inference
dev <- Mlperf inference
- Loading branch information
Showing
16 changed files
with
188 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
name: OpenAI Code Review | ||
|
||
on: | ||
pull_request: | ||
pull_request_target: | ||
types: [opened, synchronize] | ||
paths: | ||
- 'automation/**' | ||
- 'script/**' | ||
- '!**.md' | ||
|
||
permissions: | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
code_review_job: | ||
code_review: | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'gateoverflow' | ||
name: ChatGPT Code Review | ||
if: github.repository_owner == 'gateoverflow' && github.event.pull_request.changed_files > 0 | ||
steps: | ||
- name: GenAI Code Review | ||
uses: cirolini/genai-code-review@v2 | ||
with: | ||
openai_api_key: ${{ secrets.openai_api_key }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
github_pr_id: ${{ github.event.number }} | ||
openai_model: "GPT-4o" # optional | ||
openai_temperature: 0.5 # optional | ||
openai_max_tokens: 2048 # optional | ||
mode: files # files or patch | ||
language: en # optional, default is 'en' | ||
custom_prompt: "" # optional | ||
# Run code review via OpenAI | ||
# Step to run the OpenAI Code Review using the GATEOverflow action | ||
- name: Run OpenAI Code Review | ||
uses: GATEOverflow/genai-code-review@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication | ||
openai_api_key: ${{ secrets.OPENAI_API_KEY }} # OpenAI API key for accessing the GPT model | ||
github_pr_id: ${{ github.event.pull_request.number }} # ID of the pull request to review | ||
openai_model: "gpt-4o" # Model to use for the code review | ||
openai_temperature: 0.5 # Temperature setting for the model's output | ||
openai_max_tokens: 2048 # Maximum number of tokens for the model's response | ||
mode: "files" # Mode of review, can be "files" or "diff" | ||
language: "en" # Language for the review output | ||
custom_prompt: "" # Optional custom prompt for the model | ||
continue-on-error: true # Allow the workflow to continue even if this step fails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,58 @@ | ||
#!/bin/bash | ||
|
||
|
||
# Execute config command if it exists | ||
if [[ -n ${CM_DOWNLOAD_CONFIG_CMD} ]]; then | ||
echo "" | ||
echo "${CM_DOWNLOAD_CONFIG_CMD}" | ||
eval "${CM_DOWNLOAD_CONFIG_CMD}" | ||
test $? -eq 0 || exit $? | ||
echo -e "\nExecuting: ${CM_DOWNLOAD_CONFIG_CMD}" | ||
eval "${CM_DOWNLOAD_CONFIG_CMD}" || exit $? | ||
fi | ||
|
||
# Assume download is required by default | ||
require_download=1 | ||
|
||
if [[ "${CM_DOWNLOAD_LOCAL_FILE_PATH}" != "" ]]; then | ||
# No download needed if a local file path is specified or the tool is 'cmutil' | ||
if [[ -n "${CM_DOWNLOAD_LOCAL_FILE_PATH}" || ${CM_DOWNLOAD_TOOL} == "cmutil" ]]; then | ||
require_download=0 | ||
fi | ||
|
||
if [[ ${CM_DOWNLOAD_TOOL} == "cmutil" ]]; then | ||
require_download=0 | ||
|
||
elif [ -e "${CM_DOWNLOAD_DOWNLOADED_PATH}" ]; then | ||
if [[ "${CM_DOWNLOAD_CHECKSUM_CMD}" != "" ]]; then | ||
echo "" | ||
echo "${CM_DOWNLOAD_CHECKSUM_CMD}" | ||
eval "${CM_DOWNLOAD_CHECKSUM_CMD}" | ||
if [ $? -ne 0 ]; then | ||
# checksum not supposed to fail for locally given file | ||
if [[ "${CM_DOWNLOAD_LOCAL_FILE_PATH}" != "" ]]; then | ||
exit 1 | ||
else | ||
CM_PRE_DOWNLOAD_CLEAN=true | ||
fi | ||
# If the file exists, check the checksum if necessary | ||
if [[ -e "${CM_DOWNLOAD_DOWNLOADED_PATH}" && -n "${CM_DOWNLOAD_CHECKSUM_CMD}" ]]; then | ||
echo -e "\nChecking checksum: ${CM_DOWNLOAD_CHECKSUM_CMD}" | ||
eval "${CM_DOWNLOAD_CHECKSUM_CMD}" | ||
|
||
if [[ $? -ne 0 ]]; then | ||
# If the checksum fails, handle errors based on whether the file is local | ||
if [[ -n "${CM_DOWNLOAD_LOCAL_FILE_PATH}" ]]; then | ||
echo "Checksum failed for local file. Exiting." | ||
exit 1 | ||
else | ||
require_download="0" | ||
echo "Checksum failed. Marking for re-download." | ||
CM_PRE_DOWNLOAD_CLEAN=true | ||
fi | ||
else | ||
# If checksum succeeds, no download is required | ||
require_download=0 | ||
fi | ||
fi | ||
|
||
if [[ ${require_download} == "1" ]]; then | ||
# Perform download if required | ||
if [[ ${require_download} == 1 ]]; then | ||
echo "" | ||
if [ -n "${CM_PRE_DOWNLOAD_CLEAN}" ] && [ "${CM_PRE_DOWNLOAD_CLEAN,,}" != "false" ]; then | ||
echo "${CM_PRE_DOWNLOAD_CLEAN_CMD}" | ||
eval "${CM_PRE_DOWNLOAD_CLEAN_CMD}" | ||
fi | ||
|
||
echo "" | ||
echo "${CM_DOWNLOAD_CMD}" | ||
eval "${CM_DOWNLOAD_CMD}" | ||
test $? -eq 0 || exit $? | ||
# If a pre-download clean command is specified and needed, execute it | ||
if [[ -n "${CM_PRE_DOWNLOAD_CLEAN}" && "${CM_PRE_DOWNLOAD_CLEAN,,}" != "false" ]]; then | ||
echo "Executing pre-download clean: ${CM_PRE_DOWNLOAD_CLEAN_CMD}" | ||
eval "${CM_PRE_DOWNLOAD_CLEAN_CMD}" || exit $? | ||
fi | ||
|
||
# Execute the download command | ||
echo "Downloading: ${CM_DOWNLOAD_CMD}" | ||
eval "${CM_DOWNLOAD_CMD}" || exit $? | ||
fi | ||
|
||
if [[ ${CM_DOWNLOAD_TOOL} == "cmutil" || ${require_download} == "1" ]]; then | ||
if [[ "${CM_DOWNLOAD_CHECKSUM_CMD}" != "" ]]; then | ||
echo "" | ||
echo "${CM_DOWNLOAD_CHECKSUM_CMD}" | ||
eval "${CM_DOWNLOAD_CHECKSUM_CMD}" | ||
test $? -eq 0 || exit $? | ||
# Verify checksum again if necessary | ||
if [[ ${CM_DOWNLOAD_TOOL} == "cmutil" || ${require_download} == 1 ]]; then | ||
if [[ -n "${CM_DOWNLOAD_CHECKSUM_CMD}" ]]; then | ||
echo -e "\nVerifying checksum after download: ${CM_DOWNLOAD_CHECKSUM_CMD}" | ||
eval "${CM_DOWNLOAD_CHECKSUM_CMD}" || exit $? | ||
fi | ||
fi | ||
|
||
test $? -eq 0 || exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import pycuda.driver as cuda | ||
import pycuda.autoinit | ||
|
||
def get_gpu_info(): | ||
num_gpus = cuda.Device.count() | ||
all_gpu_info = [] | ||
|
||
for i in range(num_gpus): | ||
device = cuda.Device(i) | ||
cuda_runtime_version = cuda.get_version() | ||
cuda_runtime_version_str = f"{cuda_runtime_version[0]}.{cuda_runtime_version[1]}" | ||
|
||
gpu_info = { | ||
"GPU Device ID": device.pci_bus_id(), | ||
"GPU Name": device.name(), | ||
"GPU compute capability": f"{device.compute_capability()[0]}.{device.compute_capability()[1]}", | ||
"CUDA driver version": f"{cuda.get_driver_version() // 1000}.{(cuda.get_driver_version() % 1000) // 10}", | ||
"CUDA runtime version": cuda_runtime_version_str, | ||
"Global memory": device.total_memory(), | ||
"Max clock rate": f"{device.get_attribute(cuda.device_attribute.CLOCK_RATE)} MHz", | ||
"Total amount of shared memory per block": device.get_attribute(cuda.device_attribute.MAX_SHARED_MEMORY_PER_BLOCK), | ||
"Total number of registers available per block": device.get_attribute(cuda.device_attribute.MAX_REGISTERS_PER_BLOCK), | ||
"Warp size": device.get_attribute(cuda.device_attribute.WARP_SIZE), | ||
"Maximum number of threads per multiprocessor": device.get_attribute(cuda.device_attribute.MAX_THREADS_PER_MULTIPROCESSOR), | ||
"Maximum number of threads per block": device.get_attribute(cuda.device_attribute.MAX_THREADS_PER_BLOCK), | ||
"Max dimension size of a thread block X": device.get_attribute(cuda.device_attribute.MAX_BLOCK_DIM_X), | ||
"Max dimension size of a thread block Y": device.get_attribute(cuda.device_attribute.MAX_BLOCK_DIM_Y), | ||
"Max dimension size of a thread block Z": device.get_attribute(cuda.device_attribute.MAX_BLOCK_DIM_Z), | ||
"Max dimension size of a grid size X": device.get_attribute(cuda.device_attribute.MAX_GRID_DIM_X), | ||
"Max dimension size of a grid size Y": device.get_attribute(cuda.device_attribute.MAX_GRID_DIM_Y), | ||
"Max dimension size of a grid size Z": device.get_attribute(cuda.device_attribute.MAX_GRID_DIM_Z), | ||
} | ||
|
||
all_gpu_info.append(gpu_info) | ||
|
||
return all_gpu_info | ||
|
||
|
||
# Print the GPU information for all available GPUs | ||
if __name__ == "__main__": | ||
gpu_info_list = get_gpu_info() | ||
with open ("tmp-run.out", "w") as f: | ||
for idx, gpu_info in enumerate(gpu_info_list): | ||
print(f"GPU {idx}:") | ||
for key, value in gpu_info.items(): | ||
f.write(f"{key}: {value}\n") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
${CM_PYTHON_BIN_WITH_PATH} ${CM_TMP_CURRENT_SCRIPT_PATH}/detect.py | ||
test $? -eq 0 || exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.