From 4605486513b515952457b45483ea0cd860e0f544 Mon Sep 17 00:00:00 2001 From: Jing Xu Date: Tue, 20 Aug 2024 09:50:16 +0900 Subject: [PATCH] update actions.js (#3204) --- _scripts/actions.js | 222 +++++++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 85 deletions(-) diff --git a/_scripts/actions.js b/_scripts/actions.js index bcb89310f..517010c4c 100644 --- a/_scripts/actions.js +++ b/_scripts/actions.js @@ -202,16 +202,31 @@ $(document).ready(function() { items.push(item); } if(data.system_requirements.software.basekit != null) { - var item = {}; - item["Software"] = "Intel® oneAPI Base Toolkit"; - item["Version"] = data.system_requirements.software.basekit; - items.push(item); + var applyto = data.system_requirements.software.basekit.applyto; + if(applyto == null || applyto != null && $.pkgInArray(data.package, applyto)) { + var item = {}; + item["Software"] = "Intel® oneAPI Base Toolkit"; + item["Version"] = data.system_requirements.software.basekit.version; + items.push(item); + } } if(data.system_requirements.software.basekit_hotfix != null) { - var item = {}; - item["Software"] = "Intel® oneAPI Base Toolkit Hotfix"; - item["Version"] = data.system_requirements.software.basekit_hotfix; - items.push(item); + var applyto = data.system_requirements.software.basekit_hotfix.applyto; + if(applyto == null || applyto != null && $.pkgInArray(data.package, applyto)) { + var item = {}; + item["Software"] = "Intel® oneAPI Base Toolkit Hotfix"; + item["Version"] = data.system_requirements.software.basekit_hotfix; + items.push(item); + } + } + if(data.system_requirements.software.pti != null) { + var applyto = data.system_requirements.software.basekit.applyto; + if(applyto == null || applyto != null && $.pkgInArray(data.package, applyto)) { + var item = {}; + item["Software"] = "Intel® Profiling Tools Interfaces for GPU (PTI for GPU)"; + item["Version"] = data.system_requirements.software.pti.version; + items.push(item); + } } if(data.system_requirements.software.python != null) { var item = {}; @@ -266,86 +281,111 @@ $(document).ready(function() { indexb += 1; } if(data.preparation.basekit != null) { - ret += "
"; - ret += "

" + $.secid_gen([indexa, indexb]) + "Install Intel® oneAPI Base Toolkit

"; - var notes = []; - // if(data.preparation.basekit.notinstall != null) { - // var note = "

Do NOT install the following Intel® oneAPI Base Toolkit components:

"; - // note += $.ul_gen(data.preparation.basekit.notinstall); - // notes.push(note); - // } - var activate_script = "setvars.sh"; - if(data.os == "Windows") - activate_script = "setvars.bat"; - var note = "

Use either individual component-specific activation scripts to activate required components listed below one-by-one, or use the oneAPI bundle script " + activate_script + " to activate the whole oneAPI environment. Check the Sanity Test section below for a usage example.

"; - if($.pkgInArray(data.package, ["source"])) { - var note = "

Use individual component-specific activation scripts to activate required components listed below one-by-one. Check the Sanity Test section below for a usage example.

"; + var applyto = data.system_requirements.software.basekit.applyto; + if(applyto == null || applyto != null && $.pkgInArray(data.package, applyto)) { + ret += "
"; + ret += "

" + $.secid_gen([indexa, indexb]) + "Install Intel® oneAPI Base Toolkit

"; + var notes = []; + // if(data.preparation.basekit.notinstall != null) { + // var note = "

Do NOT install the following Intel® oneAPI Base Toolkit components:

"; + // note += $.ul_gen(data.preparation.basekit.notinstall); + // notes.push(note); + // } + var activate_script = "setvars.sh"; + if(data.os == "Windows") + activate_script = "setvars.bat"; + var note = "

Use either individual component-specific activation scripts to activate required components listed below one-by-one, or use the oneAPI bundle script " + activate_script + " to activate the whole oneAPI environment. Check the Sanity Test section below for a usage example.

"; + if($.pkgInArray(data.package, ["source"])) { + var note = "

Use individual component-specific activation scripts to activate required components listed below one-by-one. Check the Sanity Test section below for a usage example.

"; + } + notes.push(note); + if(data.preparation.msvc != null && + $.pkgInArray(data.package, ["source", "cppsdk"])) + notes.push("Make sure the installation includes Miscrosoft C++ Build Tools integration."); + if(data.preparation.basekit.notes != null) + notes = $.merge(notes, data.basekit.notes); + ret += $.notes_gen(notes); + + if(data.preparation.basekit.install != null) { + ret += "

The following Intel® oneAPI Base Toolkit components are required:

"; + var components = []; + $.each(data.preparation.basekit.install, function(index, value) { + placeholder_example = ""; + if(value.placeholder_example != null) + placeholder_example = ", e.g. " + value.placeholder_example + ""; + components.push(value.name + " (Placeholder " + value.placeholder + " as its installation path" + placeholder_example + ")"); + }); + ret += $.ul_gen(components); + + if(data.os == "Linux/WSL2") { + var linux_dist = []; + $.each(data.preparation.basekit.install, function(index0, value0) { + if(value0.package != null && value0.package[data.os] != null) { + $.each(Object.keys(value0.package[data.os]), function(index1, value1) { + if(!$.pkgInArray(value1, linux_dist)) { + linux_dist.push(value1); + } + }); + } + }); + if(linux_dist.length > 0) { + ret += "

Recommend using a package manager like apt, yum or dnf to install the packages above. Follow instructions at Intel® oneAPI Base Toolkit Download page to setup the package manager repository.

"; + ret += "

Take reference to commands below to install the packages on individual Linux distributions.

"; + $.each(linux_dist, function(index0, value0) { + var packages = []; + $.each(data.preparation.basekit.install, function(index1, value1) { + if(value1.package != null && value1.package[data.os] != null && value1.package[data.os][value0] != null) { + packages.push(value1.package[data.os][value0]); + } + }); + if(packages.length > 0) { + ret += "

* " + value0 + "

"; + var command = ""; + if(value0 == "Ubuntu") + command += "sudo apt install -y "; + if(value0 == "RHEL") + command += "sudo dnf install -y "; + if(value0 == "SUSE") + command += "sudo zypper install -y --oldpackage "; + command += packages.join(" "); + ret += $.code_gen([command]); + } + }); + } + } + } + ret += "
"; + indexb += 1; } - notes.push(note); - if(data.preparation.msvc != null && - $.pkgInArray(data.package, ["source", "cppsdk"])) - notes.push("Make sure the installation includes Miscrosoft C++ Build Tools integration."); - if(data.preparation.basekit.notes != null) - notes = $.merge(notes, data.basekit.notes); - ret += $.notes_gen(notes); - - if(data.preparation.basekit.install != null) { - ret += "

The following Intel® oneAPI Base Toolkit components are required:

"; + } + if(data.system_requirements.software.basekit_hotfix != null) { + var applyto = data.system_requirements.software.basekit.applyto; + if(applyto == null || applyto != null && $.pkgInArray(data.package, applyto)) { + ret += "
"; + ret += "

" + $.secid_gen([indexa, indexb]) + "Install Intel® oneAPI Base Toolkit Hotfix

"; + ret += "

Follow the link above to install Intel® oneAPI Base Toolkit Hotfix

"; + ret += "
"; + indexb += 1; + } + } + if(data.system_requirements.software.pti != null) { + var applyto = data.system_requirements.software.basekit.applyto; + if(applyto == null || applyto != null && $.pkgInArray(data.package, applyto)) { + ret += "
"; + ret += "

" + $.secid_gen([indexa, indexb]) + "Install Intel® Profiling Tools Interfaces for GPU (PTI for GPU)

"; + ret += "

Follow the link above to download and install Intel® Profiling Tools Interfaces for GPU (PTI for GPU).

"; + ret += "

The following Intel® Profiling Tools Interfaces for GPU (PTI for GPU) component is required:

"; var components = []; - $.each(data.preparation.basekit.install, function(index, value) { + $.each(data.preparation.pti.install, function(index, value) { placeholder_example = ""; if(value.placeholder_example != null) placeholder_example = ", e.g. " + value.placeholder_example + ""; components.push(value.name + " (Placeholder " + value.placeholder + " as its installation path" + placeholder_example + ")"); }); ret += $.ul_gen(components); - - if(data.os == "Linux/WSL2") { - var linux_dist = []; - $.each(data.preparation.basekit.install, function(index0, value0) { - if(value0.package != null && value0.package[data.os] != null) { - $.each(Object.keys(value0.package[data.os]), function(index1, value1) { - if(!$.pkgInArray(value1, linux_dist)) { - linux_dist.push(value1); - } - }); - } - }); - if(linux_dist.length > 0) { - ret += "

Recommend using a package manager like apt, yum or dnf to install the packages above. Follow instructions at Intel® oneAPI Base Toolkit Download page to setup the package manager repository.

"; - ret += "

Take reference to commands below to install the packages on individual Linux distributions.

"; - $.each(linux_dist, function(index0, value0) { - var packages = []; - $.each(data.preparation.basekit.install, function(index1, value1) { - if(value1.package != null && value1.package[data.os] != null && value1.package[data.os][value0] != null) { - packages.push(value1.package[data.os][value0]); - } - }); - if(packages.length > 0) { - ret += "

* " + value0 + "

"; - var command = ""; - if(value0 == "Ubuntu") - command += "sudo apt install -y "; - if(value0 == "RHEL") - command += "sudo dnf install -y "; - if(value0 == "SUSE") - command += "sudo zypper install -y --oldpackage "; - command += packages.join(" "); - ret += $.code_gen([command]); - } - }); - } - } + ret += "
"; + indexb += 1; } - ret += "
"; - indexb += 1; - } - if(data.system_requirements.software.basekit_hotfix != null) { - ret += "
"; - ret += "

" + $.secid_gen([indexa, indexb]) + "Install Intel® oneAPI Base Toolkit Hotfix

"; - ret += "

Follow the link above to install Intel® oneAPI Base Toolkit Hotfix

"; - ret += "
"; - indexb += 1; } } @@ -537,17 +577,29 @@ $(document).ready(function() { !$.pkgInArray(data.package, ["cppsdk"])) { ret += "
"; ret += "

" + $.secid_gen([indexa]) + "Sanity Test

"; + ret += "

You can run a simple sanity test to double confirm if the correct version is installed, and if the software stack can get correct hardware information onboard your system. The command should return PyTorch* and Intel® Extension for PyTorch* versions installed, as well as GPU card(s) information detected.

"; var commands = []; + var print_flag = false; if(data.system_requirements.software.basekit != null && data.preparation.basekit.install != null && - !$.pkgInArray(data.package, ["docker"])) { - ret += "

You can run a simple sanity test to double confirm if the correct version is installed, and if the software stack can get correct hardware information onboard your system. The command should return PyTorch* and Intel® Extension for PyTorch* versions installed, as well as GPU card(s) information detected.

"; - ret += "

Check section Install Intel® oneAPI Base Toolkit for placeholders used below.

"; + !$.pkgInArray(data.package, ["docker"]) && + data.system_requirements.software.basekit.applyto == null) { + print_flag = true; + } + if(print_flag) { + ret += "

Check section Install Intel® oneAPI Base Toolkit "; + if(data.preparation.pti != null) { + ret += "and Install Intel® Profiling Tools Interfaces for GPU (PTI for GPU) "; + } + ret += "for placeholders used below.

"; $.each(data.preparation.basekit.install, function(index, value) { commands.push(value.env); }); - } else { - ret += "

You can run a simple sanity test to double confirm if the correct version is installed. The command should return PyTorch* and Intel® Extension for PyTorch* versions installed.

"; + if(data.preparation.pti != null) { + $.each(data.preparation.pti.install, function(index, value) { + commands.push(value.env); + }); + } } commands.push(data.sanity_test); ret += $.code_gen(commands); @@ -672,7 +724,7 @@ $(document).ready(function() { var pair = encodeURIComponent(key) + "=" + encodeURIComponent(query_json[key]); hashes.push(pair.toLowerCase()); } - } + } window.location.hash = "#installation?" + hashes.join("&"); var formdata = new FormData(); formdata.append("query", query);