first commit
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.swp
|
||||
*.log
|
||||
*.status
|
||||
30
linux/all/etc/passwd
Normal file
30
linux/all/etc/passwd
Normal file
@@ -0,0 +1,30 @@
|
||||
root:x:0:0:Super User:/root:/bin/bash
|
||||
bin:x:1:1:bin:/bin:/usr/sbin/nologin
|
||||
daemon:x:2:2:daemon:/sbin:/usr/sbin/nologin
|
||||
adm:x:3:4:adm:/var/adm:/usr/sbin/nologin
|
||||
lp:x:4:7:lp:/var/spool/lpd:/usr/sbin/nologin
|
||||
sync:x:5:0:sync:/sbin:/bin/sync
|
||||
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
||||
halt:x:7:0:halt:/sbin:/sbin/halt
|
||||
mail:x:8:12:mail:/var/spool/mail:/usr/sbin/nologin
|
||||
operator:x:11:0:operator:/root:/usr/sbin/nologin
|
||||
games:x:12:100:games:/usr/games:/usr/sbin/nologin
|
||||
ftp:x:14:50:FTP User:/var/ftp:/usr/sbin/nologin
|
||||
nobody:x:65534:65534:Kernel Overflow User:/:/usr/sbin/nologin
|
||||
tss:x:59:59:Account used for TPM access:/:/usr/sbin/nologin
|
||||
systemd-oom:x:999:999:systemd Userspace OOM Killer:/:/sbin/nologin
|
||||
dbus:x:81:81:System Message Bus:/:/usr/sbin/nologin
|
||||
polkitd:x:114:114:User for polkitd:/:/sbin/nologin
|
||||
clevis:x:998:997:Clevis Decryption Framework unprivileged user:/var/cache/clevis:/usr/sbin/nologin
|
||||
sssd:x:997:996:User for sssd:/run/sssd/:/sbin/nologin
|
||||
libstoragemgmt:x:995:995:daemon account for libstoragemgmt:/:/usr/sbin/nologin
|
||||
systemd-coredump:x:994:994:systemd Core Dumper:/:/usr/sbin/nologin
|
||||
setroubleshoot:x:993:993:SELinux troubleshoot server:/var/lib/setroubleshoot:/usr/sbin/nologin
|
||||
sshd:x:74:74:Privilege-separated SSH:/usr/share/empty.sshd:/usr/sbin/nologin
|
||||
chrony:x:992:992:chrony system user:/var/lib/chrony:/sbin/nologin
|
||||
tcpdump:x:72:72:tcpdump:/:/usr/sbin/nologin
|
||||
dhcpcd:x:991:990:Minimalistic DHCP client:/var/lib/dhcpcd:/usr/sbin/nologin
|
||||
git:x:990:989:Git Version Control:/home/git:/bin/bash
|
||||
nginx:x:989:988:Nginx web server:/var/lib/nginx:/sbin/nologin
|
||||
caddy:x:988:987::/home/caddy:/bin/false
|
||||
admin:x:1000:1000::/home/admin:/bin/bash
|
||||
1
pkgs/cuda-13.0/include
Symbolic link
1
pkgs/cuda-13.0/include
Symbolic link
@@ -0,0 +1 @@
|
||||
targets/x86_64-linux/include
|
||||
1
pkgs/cuda-13.0/lib64
Symbolic link
1
pkgs/cuda-13.0/lib64
Symbolic link
@@ -0,0 +1 @@
|
||||
targets/x86_64-linux/lib
|
||||
504
pkgs/cuda-13.0/nvml/doc/nvml_changelog.txt
Normal file
504
pkgs/cuda-13.0/nvml/doc/nvml_changelog.txt
Normal file
@@ -0,0 +1,504 @@
|
||||
/*! @page KnownIssues Known issues in the current version of NVML library
|
||||
*
|
||||
* This is a list of known NVML issues in the current driver:
|
||||
* - NVML Field Values from #251 - #273 (Power Smoothing, Clock Event Reason, and Sync Power Balancing related field values) have changed between 13.0 and 13.0U1/v580TRD2.
|
||||
* - Any application that is using these field IDs must be recompiled using the NVML header file from CUDA 13.0 Update 1 in order to continue working correctly with NVIDIA drivers v580 TRD2 and beyond.
|
||||
* - On systems where GPUs are NUMA nodes, the accuracy of FB memory utilization provided by NVML depends on the memory accounting of the operating system.
|
||||
* This is because FB memory is managed by the operating system instead of the NVIDIA GPU driver.
|
||||
* Typically, pages allocated from FB memory are not released even after the process terminates to enhance performance. In scenarios where
|
||||
* the operating system is under memory pressure, it may resort to utilizing FB memory. Such actions can result in discrepancies in the accuracy of memory reporting.
|
||||
* - On Linux GPU Reset can't be triggered when there is pending GPU Operation Mode (GOM) change
|
||||
* - On Linux GPU Reset may not successfully change pending ECC mode. A full reboot may be required to enable the mode change.
|
||||
* - \ref nvmlAccountingStats supports only one process per GPU at a time (CUDA proxy server counts as one process).
|
||||
* - \ref nvmlAccountingStats_t.time reports time and utilization values starting from cuInit till process termination. Next driver versions might change this behavior slightly and account process only from cuCtxCreate till cuCtxDestroy.
|
||||
* - On GPUs from Fermi family current P0 clocks (reported by \ref nvmlDeviceGetClockInfo) can differ from max clocks by few MHz.
|
||||
*/
|
||||
/*! @page Changelog Change log of NVML library
|
||||
* This chapter list changes in API and bug fixes that were introduced to the library
|
||||
* \section changelog32 Changes between NVML v575 and v580 ===
|
||||
* - Fixed bug with NVML_FI_PWR_SMOOTHING_* Field Value numbering, which was different than the v570 values.
|
||||
* - Adjusted NVML_FI_DEV_CLOCKS_EVENT_REASON_* and NVML_FI_DEV_POWER_SYNC_BALANCING_* field value numbering to resolve overlap with NVML_FI_PWR_SMOOTHING_* field values.
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts to get the counts of SRAM unique uncorrected ECC errors.
|
||||
* - Deprecated Applications Clocks APIs, which will be removed in CUDA 14.0:
|
||||
* - \ref nvmlDeviceSetApplicationsClocks
|
||||
* - \ref nvmlDeviceGetApplicationsClock
|
||||
* - \ref nvmlDeviceGetDefaultApplicationsClock
|
||||
* - \ref nvmlDeviceResetApplicationsClocks
|
||||
* - Deprecated \ref nvmlDeviceGetViolationStatus, which will be removed in CUDA 14.0
|
||||
* - Added \ref nvmlDeviceGetNvLinkInfo to query device NVLINK info.
|
||||
* - Added \ref nvmlDeviceGetPdi to retrieve the device GPU PDI.
|
||||
* - Added Multi-GPU mode NVLINK Encryption \ref NVML_CC_SYSTEM_MULTIGPU_NVLE
|
||||
* - Added V2 struct to \ref nvmlDeviceGetNvLinkInfo to query NVLINK Firmware info.
|
||||
* - Added \ref nvmlDeviceReadWritePRM_v1 to retrieve GPU PRM register contents
|
||||
* - Added \ref nvmlDeviceGetAddressingMode to retrieve the addressing mode for the device.
|
||||
* - Added \ref nvmlDeviceGetRepairStatus to get ECC status info.
|
||||
* - Added \ref nvmlDeviceGetGpuInstanceProfileInfoByIdV which allows for MIG GPU instance profile info to be queried with profileId instead of profile name.
|
||||
* - Updated nvmlGpuFabricInfoV_t to v3 to include a new Health Summary field, and new Incorrect Configuration statuses.
|
||||
- nvmlGpuFabricInfo_v2_t is deprecated and will be removed in a future release
|
||||
* - Added \ref nvmlDeviceGetPowerMizerMode_v1 to query the current and supported power mizer modes on Maxwell and newer gpus. Power mizer mode provides a hint to the driver as to how to manage the performance of the GPU.
|
||||
* - Added \ref nvmlDeviceSetPowerMizerMode_v1 to set the power mizer mode on Maxwell and newer gpus.
|
||||
* - Added new Incorrect Configuration Statuses to nvmlGpuFabricInfoV_t
|
||||
* - NVML_GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INCOMPATIBLE_GPU_FW
|
||||
* - NVML_GPU_FABRIC_HEALTH_MASK_INCORRECT_CONFIGURATION_INVALID_LOCATION
|
||||
* - Added \ref nvmlDeviceSetHostname_v1 and \ref nvmlDeviceGetHostname_v1 to allow custom GPU hostname configuration.
|
||||
* \section changelog31 Changes between NVML v570 and v575 ===
|
||||
*
|
||||
* - Added \ref nvmlSystemEventSetCreate to create a system event set.
|
||||
* - Added \ref nvmlSystemEventSetFree to free a system event set.
|
||||
* - Added \ref nvmlSystemRegisterEvents to register system events on a system event set.
|
||||
* - Added \ref nvmlSystemEventSetWait to wait for system event notification and obtain system event data.
|
||||
* - Added \ref nvmlGpuInstanceGetCreatableVgpus to query the currently creatable vGPU types on the user provided GPU Instance
|
||||
* - Added \ref nvmlVgpuTypeGetMaxInstancesPerGpuInstance to query the maximum number of vGPU instances per GPU Instance for the given vGPU type
|
||||
* - Added \ref nvmlGpuInstanceSetVgpuSchedulerState to set the vGPU scheduler state for the given GPU Instance
|
||||
* - Added \ref nvmlGpuInstanceGetActiveVgpus to query the currently active vGPU instances on the user provided GPU Instance
|
||||
* - Added \ref nvmlGpuInstanceGetVgpuSchedulerState to query the vGPU software scheduler state for the given GPU Instance.
|
||||
* - Added \ref nvmlGpuInstanceGetVgpuSchedulerLog to query the vGPU software scheduler logs for the given GPU Instance.
|
||||
* - Added \ref nvmlGpuInstanceGetVgpuTypeCreatablePlacements to query the creatable vGPU placement IDs of the vGPU type within a GPU instance
|
||||
* - Added \ref nvmlGpuInstanceSetVgpuHeterogeneousMode to enable or disable vGPU heterogenous mode for the GPU Instance.
|
||||
* - Added \ref nvmlGpuInstanceGetVgpuHeterogeneousMode to query the vGPU heterogenous mode for the GPU Instance.
|
||||
* - Updated \ref nvmlDeviceGetVgpuCapabilities to report whether GPU supports timesliced vGPU on MIG and whether MIG timesliced mode is enabled or not vGPU capabilities.
|
||||
* - Updated \ref nvmlDeviceSetVgpuCapabilities to set the MIG timesliced mode vGPU capability of a device.
|
||||
* - Updated \ref nvmlDeviceSetVgpuHeterogeneousMode to return \ref NVML_ERROR_NOT_SUPPORTED when in MIG mode.
|
||||
* - Updated \ref nvmlDeviceGetVgpuHeterogeneousMode to return \ref NVML_ERROR_NOT_SUPPORTED when in MIG mode.
|
||||
* - Updated \ref nvmlDeviceGetVgpuTypeCreatablePlacements to return \ref NVML_ERROR_NOT_SUPPORTED when in MIG mode.
|
||||
* - Updated \ref nvmlDeviceGetVgpuSchedulerLog to return \ref NVML_ERROR_NOT_SUPPORTED when in MIG mode.
|
||||
* - Updated \ref nvmlDeviceSetVgpuSchedulerState to return \ref NVML_ERROR_NOT_SUPPORTED when in MIG mode.
|
||||
* - Updated \ref nvmlDeviceGetVgpuSchedulerState to return \ref NVML_ERROR_NOT_SUPPORTED when in MIG mode.
|
||||
* - Added 3 new NVML_FI_DEV_C2C_LINK_ERROR fieldIds
|
||||
* - \ref NVML_FI_DEV_C2C_LINK_ERROR_INTR
|
||||
* - \ref NVML_FI_DEV_C2C_LINK_ERROR_REPLAY
|
||||
* - \ref NVML_FI_DEV_C2C_LINK_ERROR_REPLAY_B2B
|
||||
* - Added new NVML_FI_DEV_C2C_LINK_POWER_STATE fieldId
|
||||
* - Added new CTXSW GPM Metrics
|
||||
* - Added \ref nvmlDeviceGetHandleByUUIDV that supports both the ASCII and binary format UUID to retrieve the device handle.
|
||||
* - Added 2 new NVML_FI_DEV_POWER_SYNC_BALANCING fieldIds
|
||||
* - \ref NVML_FI_DEV_POWER_SYNC_BALANCING_FREQ
|
||||
* - \ref NVML_FI_DEV_POWER_SYNC_BALANCING_AF
|
||||
* - Added 5 new Clock Event Reason Counters fieldIds
|
||||
* - \ref NVML_FI_DEV_CLOCKS_EVENT_REASON_SW_POWER_CAP
|
||||
* - \ref NVML_FI_DEV_CLOCKS_EVENT_REASON_SYNC_BOOST
|
||||
* - \ref NVML_FI_DEV_CLOCKS_EVENT_REASON_SW_THERM_SLOWDOWN
|
||||
* - \ref NVML_FI_DEV_CLOCKS_EVENT_REASON_HW_THERM_SLOWDOWN
|
||||
* - \ref NVML_FI_DEV_CLOCKS_EVENT_REASON_HW_POWER_BRAKE_SLOWDOWN
|
||||
* - Updated \ref nvmlDeviceGetMemoryErrorCounter to better account for transient vs. permanent errors
|
||||
* - Added MIG profiles that can allocate all or none of Decoder, Encoder, JPEG and OFA engines.
|
||||
*
|
||||
* \section changelog30 Changes between NVML v565 Update and v570 ===
|
||||
* - Revert the fix for the issue where PCIe throughput (reported via \ref nvmlDeviceGetPcieThroughput and nvidia-smi -q) is 1000 times bigger than its actual value
|
||||
* - Added field values for data related to Power Smoothing
|
||||
* - Added \ref nvmlDevicePowerSmoothingActivatePresetProfile to activate a specific Preset Profile for Power Smoothing
|
||||
* - Added \ref nvmlDevicePowerSmoothingSetState to enable/disable the Power Smoothing feature
|
||||
* - Added \ref nvmlDevicePowerSmoothingUpdatePresetProfileParam to update parameters to preset profiles for Power Smoothing
|
||||
* - Added new enums for fieldId NVML_FI_DEV_NVLINK_GET_STATE to expose INACTIVE, ACTIVE, and SLEEP state for a link
|
||||
* - Added \ref nvmlDeviceGetMarginTemperature to retrieve the thermal margin temperature (distance to nearest slowdown threshold).
|
||||
* - Added \ref nvmlDeviceGetNvlinkSupportedBwModes to get all supported Nvlink Bandwidth modes
|
||||
* - Added \ref nvmlDeviceGetNvlinkBwMode to get the current Nvlink Bandwidth mode
|
||||
* - Added \ref nvmlDeviceSetNvlinkBwMode to set the Nvlink Bandwidth mode
|
||||
* - Added MIG profiles with support for graphics.
|
||||
* - Added support for new recovery action - NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET
|
||||
* - Deprecated nvml fieldIds NVML_FI_DEV_RESET_STATUS and NVML_FI_DEV_DRAIN_AND_RESET_STATUS. Usee NVML_FI_DEV_GET_GPU_RECOVERY_ACTION instead
|
||||
* - Added \ref nvmlDeviceGetDramEncryptionMode and \ref nvmlDeviceSetDramEncryptionMode to query and configure DRAM Encryption Mode
|
||||
* - Added 3 new flags to GPU Fabric Health Mask
|
||||
* - NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ROUTE_RECOVERY
|
||||
* - NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ROUTE_UNHEALTHY
|
||||
* - NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_ACCESS_TIMEOUT_RECOVERY
|
||||
* - Added 4 new GPM metrics
|
||||
* - NVML_GPM_METRIC_NVENC_0_UTIL
|
||||
* - NVML_GPM_METRIC_NVENC_1_UTIL
|
||||
* - NVML_GPM_METRIC_NVENC_2_UTIL
|
||||
* - NVML_GPM_METRIC_NVENC_3_UTIL
|
||||
* - Added new counters for Nvlink5
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_EFFECTIVE_ERRORS to get sum of the number of errors in each Nvlink packet
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_EFFECTIVE_BER to get Effective BER for effective errors
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_FEC_HISTORY_0 to 15 to get count of symbol errors that are corrected
|
||||
* - Swapped the values of field IDs \ref NVML_FI_DEV_IS_MIG_MODE_INDEPENDENT_MIG_QUERY_CAPABLE and \ref NVML_FI_DEV_NVLINK_GET_POWER_THRESHOLD_MAX to fix backwards compatibility with v550.
|
||||
* - New revision of nvmlPlatformInfo_t -- nvmlPlatformInfo_v2 has been added. In this version the following fields from v1 have been renamed
|
||||
* - rackGuid to chassisSerialNumber
|
||||
* - chassisPhysicalSlotNumber to slotNumber
|
||||
* - computeSlotIndex to trayIndex
|
||||
* - nodeIndex to hostId
|
||||
* - nvmlPlatformInfo_v1 is deprecated and will be removed in subsequent releases
|
||||
*
|
||||
* \section changelog29 Changes between NVML v560 Update and v565 ===
|
||||
* - Fixed the ECC error count mismatch between nvidia-smi query output and NVML APIs, \ref nvmlDeviceGetMemoryErrorCounter and \ref nvmlDeviceGetFieldValues.
|
||||
* - Added new value NVML_CC_SYSTEM_CPU_CAPS_AMD_SNP_VTOM for CC CPU capability reporting
|
||||
* - Added \ref nvmlDeviceGetCoolerInfo to retrieve a cooler's control signal characteristics and target that cooler cools.
|
||||
* - Added new value NVML_CC_SYSTEM_CPU_CAPS_AMD_SEV_SNP for CC CPU capability reporting
|
||||
* - Added \ref nvmlDeviceGetFanSpeedRPM to report the intended operating speed in rotations per minute (RPM) of the device's specified fan.
|
||||
* - Added \ref nvmlDeviceGetPerformanceModes to retrieve a performance modes string with all the performance modes defined for this device along with their associated GPU Clock and Memory Clock values.
|
||||
* - Added \ref nvmlDeviceGetCurrentClockFreqs to retrieve a string with the associated GPU Clock and Memory Clock values for the current pstate.
|
||||
* - Added \ref nvmlNvlinkVersion_t enum to define NvLink Version
|
||||
* - Added \ref nvmlDeviceGetPlatformInfo to retrieve the platform information of a device
|
||||
* - Added new event type nvmlEventTypeGpuUnavailableError
|
||||
* - Removed support for \p nvmlDeviceGetNvLinkCrcLaneErrorCounter \p nvmlDeviceGetNvLinkEccLaneErrorCounter \p nvmlDeviceGetNvLinkErrorCounter on Blackwell
|
||||
* - Removed support for fieldIds \ref NVML_FI_DEV_NVLINK_ERROR_DL_REPLAY \ref NVML_FI_DEV_NVLINK_ERROR_DL_RECOVERY \ref NVML_FI_DEV_NVLINK_ERROR_DL_CRC on Blackwell
|
||||
* - Added \ref nvmlVgpuInstanceGetRuntimeStateSize to get the vGPU runtime state size
|
||||
* - Updated nvmlDeviceGetVgpuTypeSupportedPlacements function to report both Heterogeneous and Homogeneous vGPU placements.
|
||||
* - Updated nvmlDeviceGetVgpuCapabilities to report the Homogeneous vGPU capability.
|
||||
* - Added \ref nvmlDeviceWorkloadPowerProfileGetProfilesInfo to retrieve Workload Power Profile Info
|
||||
* - Added \ref nvmlDeviceWorkloadPowerProfileGetCurrentProfiles to retrieve current Requested and Enforced Workload Power Profiles
|
||||
* - Added \ref nvmlDeviceWorkloadPowerProfileSetRequestedProfiles to set Requested Workload Power Profiles
|
||||
* - Added \ref nvmlDeviceWorkloadPowerProfileClearRequestedProfiles to clear Requested Performance Profiles
|
||||
* - Added new event type nvmlEventTypeGpuRecoveryAction
|
||||
* - Added new fieldId to query gpu recovery action NVML_FI_DEV_GET_GPU_RECOVERY_ACTION
|
||||
* - Deprecated fieldIds
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_VL15_DROPPED to get Number of VL15 MADs dropped on a link in NVLink5
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RAW_BER_LANE0 to get BER per lane for lane 0
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RAW_BER_LANE1 to get BER per lane for lane 1
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RAW_BER to get BER per link. Sum of all the raw errors per lane/Bits received per link
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_EFFECTIVE_ERRORS to get Sum of the number of errors in each Nvlink packet
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_EFFECTIVE_BER to get Effective BER for effective errors
|
||||
*
|
||||
* \section changelog28 Changes between NVML v555 Update and v560 ===
|
||||
*
|
||||
* - Added field values NVML_FI_DEV_PCIE_OUTBOUND_ATOMICS_MASK and NVML_FI_DEV_PCIE_INBOUND_ATOMICS_MASK for nvmlDeviceGetFieldValues.
|
||||
* - Added field ids NVML_FI_DEV_RESET_STATUS and NVML_FI_DEV_DRAIN_AND_RESET_STATUS which correspond to the nvidia-smi output.
|
||||
* - Added NVML_DEVICE_ARCH_T23X architecture type.
|
||||
* - Added \ref nvmlVgpuTypeGetBAR1Info to query the BAR1 information of a vGPU type.
|
||||
* - Added new event types, nvmlEventTypeSingleBitEccErrorStorm, nvmlEventTypeDramRetirementEvent, nvmlEventTypeDramRetirementFailure, nvmlEventTypeNonFatalPoisonError and nvmlEventTypeFatalPoisonError.
|
||||
* - Added \ref nvmlSystemGetDriverBranch to query the driver branch information.
|
||||
*
|
||||
* \section changelog27 Changes between NVML v550 Update and v555 ===
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetClockOffsets to query min, max and current clock offset value on a Maxwell and later GPU for a specified clock.
|
||||
* - Added \ref nvmlDeviceSetClockOffsets to control clock offset value on a Maxwell and later GPU for a specified clock.
|
||||
* - Added new fieldIds for Nvlink5 telemetry on Blackwell
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_XMIT_PACKETS to get Total Tx packets on the link in NVLink5
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_XMIT_BYTES to get Total Tx bytes on the link in NVLink5
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RCV_PACKETS to get Total Rx packets on the link in NVLink5
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RCV_BYTES to get Total Rx bytes on the link in NVLink5
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_VL15_DROPPED to get Number of VL15 MADs dropped on a link in NVLink5
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_MALFORMED_PACKET_ERRORS to get Number of packets Rx on a link where packets are malformed
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_BUFFER_OVERRUN_ERRORS to get Number of packets that were discarded on Rx due to buffer overrun
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RCV_ERRORS to get Total number of packets with errors Rx on a link
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RCV_REMOTE_ERRORS to get Total number of packets Rx - stomp/EBP marker
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RCV_GENERAL_ERRORS to get Total number of packets Rx with header mismatch
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_LOCAL_LINK_INTEGRITY_ERRORS to get Total number of times that the count of local errors exceeded a threshold
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_XMIT_DISCARDS to get Total number of tx error packets that were discarded
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_LINK_RECOVERY_SUCCESSFUL_EVENTS to get Number of times link went from Up to recovery, succeeded and link came back up
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_LINK_RECOVERY_FAILED_EVENTS to get Number of times link went from Up to recovery, failed and link was declared down
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_LINK_RECOVERY_EVENTS to get Number of times link went from Up to recovery, irrespective of the result
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RAW_BER_LANE0 to get BER per lane for lane 0
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RAW_BER_LANE1 to get BER per lane for lane 1
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_RAW_BER to get BER per link. Sum of all the raw errors per lane/Bits received per link
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_EFFECTIVE_ERRORS to get Sum of the number of errors in each Nvlink packet
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_EFFECTIVE_BER to get Effective BER for effective errors
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_SYMBOL_ERRORS to get Number of errors in rx symbols
|
||||
* - \ref NVML_FI_DEV_NVLINK_COUNT_SYMBOL_BER to get BER for symbol errors
|
||||
* - Added two new field ids NVML_FI_DEV_PCIE_COUNT_TX_BYTES and NVML_FI_DEV_PCIE_COUNT_RX_BYTES for nvmlDeviceGetFieldValues.
|
||||
* - Added new API nvmlDeviceGetCapabilities with the first capability bit NVML_DEV_CAP_EGM for Extended GPU Memory (EGM) capability.
|
||||
* - Added multiGpuMode display on CC enabled system via new API nvmlSystemGetConfComputeSettings or "nvidia-smi conf-compute --get-multigpu-mode" or "nvidia-smi conf-compute -mgm".
|
||||
* - Added new field ID \ref NVML_FI_DEV_NVLINK_GET_POWER_THRESHOLD_MAX to get the Max Nvlink Power Threshold for a device.
|
||||
* - Deprecated \ref nvmlDeviceGetTemperature and replaced with a new API \ref nvmlDeviceGetTemperatureV to retrieve device temperature.
|
||||
* - Added new field ID \ref NVML_VGPU_DRIVER_CAP_WARM_UPDATE and NVML_DEVICE_VGPU_CAP_WARM_UPDATE to query whether the driver and the device supports FSR and warm update of vGPU host driver without terminating the running guest VM respectively.
|
||||
* - Added new field ID \ref NVML_FI_DEV_NVLINK_GET_POWER_THRESHOLD_MIN to get the Min Nvlink Power Threshold for a device.
|
||||
* - Added new field ID \ref NVML_FI_DEV_NVLINK_GET_POWER_THRESHOLD_UNITS to get the Units of the Nvlink Power Threshold for a device.
|
||||
* - Added new field ID \ref NVML_FI_DEV_NVLINK_GET_POWER_THRESHOLD_SUPPORTED to get if Nvlink Power Threshold is supported for a device.
|
||||
*
|
||||
*
|
||||
* \section changelog26 Changes between NVML v545 Update and v550 ===
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetNumaNodeId to query the NUMA node of a GPU.
|
||||
* - Fix the issue where PCIe throughput (reported via nvmlDeviceGetPcieThroughput and nvidia-smi -q) is 1000 times bigger than its actual value.
|
||||
* - Added new GPM metric Id NVML_GPM_METRIC_NVOFA_1_UTIL to \ref nvmlGpmMetricId_t.
|
||||
* - Added new field ID \ref NVML_FI_DEV_IS_MIG_MODE_INDEPENDENT_MIG_QUERY_CAPABLE, to check MIG query capable device irrespective of MIG mode.
|
||||
* - Deprecated NVML_P2P_CAPS_INDEX_PROP and added NVML_P2P_CAPS_INDEX_PCI to reflect the same P2P capability.
|
||||
* - Added \ref nvmlDeviceGetProcessesUtilizationInfo to retrieve the recent utilization and process ID for all running processes.
|
||||
* - Added new struct \ref nvmlProcessesUtilizationInfo_v1_t, which includes the new utilization of NVJPG and NVOFA.
|
||||
* - Added \ref nvmlDeviceGetVgpuInstancesUtilizationInfo to retrieve the recent utilization for vGPU instances running on a physical GPU.
|
||||
* - Added \ref nvmlDeviceGetVgpuProcessesUtilizationInfo to retrieve the recent utilization for processes running on vGPU instances on a physical GPU.
|
||||
* - Added \ref nvmlDeviceSetVgpuHeterogeneousMode to enable or disable vGPU heterogenous mode for the device.
|
||||
* - Added \ref nvmlDeviceGetVgpuHeterogeneousMode to query the vGPU heterogenous mode for the device.
|
||||
* - Added \ref nvmlVgpuInstanceGetPlacementId to query placement ID of the active vGPU instance.
|
||||
* - Added \ref nvmlDeviceGetVgpuTypeSupportedPlacements to query the supported vGPU placement IDs of a vGPU type.
|
||||
* - Added \ref nvmlDeviceGetVgpuTypeCreatablePlacements to query the creatable vGPU placement IDs of a vGPU type.
|
||||
* - Added support to display confidential compute protected memory along with fb & bar1 in nvidia-smi pmon & dmon commands.
|
||||
* - Added \ref nvmlDeviceGetGpuFabricInfoV to query Gpu Fabric Probe Info for the device.
|
||||
* - Deprecated \ref nvmlDeviceGetGpuFabricInfo. This function should not be used, and will be removed in a future release. Use \ref nvmlDeviceGetGpuFabricInfoV instead.
|
||||
* - Modified \ref nvmlDeviceGetGpuInstanceProfileInfo and \ref nvmlDeviceGetGpuInstancePossiblePlacements_v2 to no longer require MIG being enabled
|
||||
* - Added \ref nvmlSystemSetConfComputeKeyRotationThresholdInfo to set confidential compute key rotation threshold.
|
||||
* - Added \ref nvmlSystemGetConfComputeKeyRotationThresholdInfo to query confidential compute key rotation threshold detail.
|
||||
* - Added \ref nvmlDeviceSetVgpuCapabilities to set the desirable vGPU capability of a device.
|
||||
*
|
||||
*
|
||||
* \section changelog25 Changes between NVML v535 Update and v545 ===
|
||||
*
|
||||
* - Added a new error code \ref NVML_ERROR_GPU_NOT_FOUND to be returned if no supported GPUS are found during initialization.
|
||||
* - In \ref nvmlGpuFabricInfo_t \p partitionId has been renamed to \p cliqueId.
|
||||
* - Added new versioned structs \ref nvmlGpuInstanceProfileInfo_v3_t and \ref nvmlComputeInstanceProfileInfo_v3_t.
|
||||
* - Added \ref nvmlDeviceGetLastBBXFlushTime for retrieving the timestamp and duration of the latest flush of the BBX object to the inforom storage.
|
||||
* - Added \ref NVML_POWER_SCOPE_MEMORY to report out power usage for GPU Memory.
|
||||
* - Added \ref nvmlDeviceGetPciInfoExt which expands \ref nvmlDeviceGetPciInfo_v3 to also report PCI base and sub classcodes.
|
||||
* - Added new struct \ref nvmlPciInfoExt_v1_t, which is used in \ref nvmlDeviceGetPciInfoExt.
|
||||
* - Added \ref nvmlDeviceGetRunningProcessDetailList api to get information about Compute, Graphics or MPS-Compute processes running on a GPU with protected memory usage info.
|
||||
*
|
||||
*
|
||||
* \section changelog24 Changes between NVML v530 Update and v535 ===
|
||||
*
|
||||
* - Fixed \ref nvmlDeviceGetMemoryErrorCounter and \ref nvmlDeviceGetFieldValues to return correct SRAM volatile total error counts.
|
||||
* - Added \ref nvmlDeviceGetSramEccErrorStatus to query SRAM ECC error status for the device.
|
||||
* - Added \ref nvmlDeviceGetModuleId for getting device module id
|
||||
* - Updated \ref nvmlDeviceGetPowerSource API to report undersized power source.
|
||||
* - Added \ref nvmlDeviceGetJpgUtilization and \ref nvmlDeviceGetOfaUtilization APIs
|
||||
* - Added \ref nvmlSystemGetNvlinkBwMode and \ref nvmlSystemSetNvlinkBwMode APIs
|
||||
* - Added \ref nvmlDeviceSetVgpuSchedulerState to set the vGPU scheduler state.
|
||||
* - Added new field ID \ref NVML_FI_DEV_IS_RESETLESS_MIG_SUPPORTED for device's resetless MIG capability
|
||||
* - Added \ref nvmlDeviceGetComputeRunningProcesses_v3 to get information about Compute processes running on a GPU.
|
||||
* - Added \ref nvmlDeviceGetGraphicsRunningProcesses_v3 to get information about Graphics processes running on a GPU.
|
||||
* - Added \ref nvmlDeviceGetMPSComputeRunningProcesses_v3 to get information about MPS-Compute processes running on a GPU.
|
||||
* - Added \ref nvmlDeviceGetRunningProcessDetailList to get information about Compute, Graphics or MPS-Compute processes running on a GPU with protected memory usage info. Currently returns NVML_ERROR_NOT_SUPPORTED. Functionality will be implemented in next release.
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_CORRECTABLE_ERRORS for PCIe correctable errors counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_NAKS_RECEIVED for PCIe NAK Receive counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_RECEIVER_ERROR for PCIe receiver error counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_BAD_TLP for PCIe bad TLP counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_NAKS_SENT for NAK Send counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_BAD_DLLP for PCIe bad DLLP counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_NON_FATAL_ERROR for PCIe non fatal error counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_FATAL_ERROR for PCIe fatal error counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_UNSUPPORTED_REQ for PCIe unsupported request counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_LCRC_ERROR for PCIe LCRC error counter
|
||||
* - Added new field ID \ref NVML_FI_DEV_PCIE_COUNT_LANE_ERROR for per lane error counter with scope as PCIe lane number.
|
||||
* - Added \ref nvmlDeviceGetPowerUsage to retrieve current power usage
|
||||
* - Added \ref nvmlDeviceGetTotalEnergyConsumption to get current energy consumption
|
||||
* - Added \ref nvmlDeviceSetPowerManagementLimit_v2 to set the power limit
|
||||
* - Renamed nvmlDeviceCcuGetStreamState to nvmlGpmQueryIfStreamingEnabled and nvmlDeviceCcuSetStreamState to nvmlGpmSetStreamingEnabled.
|
||||
*
|
||||
*
|
||||
* \section changelog23 Changes between NVML v525 Update and v530 ===
|
||||
*
|
||||
* - Fixed a typo in nvmlGpuP2PStatus_t: added a new enum entry for NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED with the same numeric value as the existing erroneous entry ("NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED")
|
||||
* - Added \ref nvmlDeviceGetVgpuSchedulerLog to fetch the vGPU software scheduler logs.
|
||||
* - Added \ref nvmlDeviceGetVgpuSchedulerState to fetch the vGPU software scheduler state.
|
||||
* - Added \ref nvmlDeviceGetVgpuSchedulerCapabilities to fetch the vGPU software scheduler capabilities.
|
||||
*
|
||||
*
|
||||
* \section changelog22 Changes between NVML v520 Update and v525 ===
|
||||
*
|
||||
* - Added \ref nvmlDeviceSetNvLinkDeviceLowPowerThreshold to set the NvLink low power threshold.
|
||||
* - Added \p nvmlDeviceGetPcieAtomicCaps to report PCIe atomic capabilities.
|
||||
* - Added \p nvmlDeviceCcuGetStreamState API to report the counter collection unit stream state.
|
||||
* - Added \p nvmlDeviceCcuSetStreamState API to set the counter collection unit stream state.
|
||||
* - Removed support for NVML_FI_DEV_LINK_SPEED_MBPS_L{0..} field Ids in Hopper. Replaced with NVML_FI_DEV_NVLINK_GET_SPEED with scope as link Id.
|
||||
* - Removed support for NVML_FI_DEV_NVLINK_CRC_FLIT_ERROR_COUNT{0..} field Ids in Hopper. Replaced with NVML_FI_DEV_NVLINK_ERROR_DL_CRC with scope as link Id.
|
||||
* - Removed support for NVML_FI_DEV_NVLINK_REPLAY_ERROR_COUNT_L{0..} field Ids in Hopper. Replaced with NVML_FI_DEV_NVLINK_ERROR_DL_REPLAY with scope as link Id.
|
||||
* - Removed support for NVML_FI_DEV_NVLINK_RECOVERY_ERROR_COUNT_{0..} field Ids in Hopper. Replaced with NVML_FI_DEV_NVLINK_ERROR_DL_RECOVERY with scope as link Id.
|
||||
* - Added new field ID \ref NVML_FI_DEV_NVLINK_GET_STATE to get nvlink state
|
||||
* - Added new field ID \ref NVML_FI_DEV_NVLINK_GET_VERSION to get nvlink version
|
||||
* - Added new field ID \ref NVML_FI_DEV_C2C_LINK_COUNT to get C2C link count
|
||||
* - Added new field ID \ref NVML_FI_DEV_C2C_LINK_GET_STATUS to get C2C link status
|
||||
* - Added new field ID \ref NVML_FI_DEV_C2C_LINK_GET_MAX_BW to get C2C link bandwidth
|
||||
*
|
||||
*
|
||||
* \section changelog21 Changes between NVML v515 Update and v520 ===
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetMemClkVfOffset API to report the MemClk VF offset value.
|
||||
* - Added \ref nvmlDeviceGetMemClkMinMaxVfOffset API to report the Memory clock min and max VF offset that user can set for a specified GPU.
|
||||
* - Added \ref nvmlDeviceGetGpcClkMinMaxVfOffset API to report the Graphics clock min and max VF offset that user can set for a specified GPU.
|
||||
* - Added \ref nvmlGpmMetricsGet to calculate GPM metrics from two GPM samples
|
||||
* - Added \ref nvmlGpmSampleFree to free allocated GPM sample
|
||||
* - Added \ref nvmlGpmSampleAlloc to allocate a GPM sample
|
||||
* - Added \ref nvmlGpmSampleGet to retrieve a GPM snapshot
|
||||
* - Added \ref nvmlGpmQueryDeviceSupport to query whether a device supports GPM
|
||||
* - Added \ref nvmlDeviceGetFanControlPolicy_v2 API to report the control policy for a specified GPU fan.
|
||||
* - Added \ref nvmlDeviceSetFanControlPolicy API to set the control policy for a specified GPU fan.
|
||||
*
|
||||
*
|
||||
* \section changelog20 Changes between NVML v510 Update and v515 ===
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetMinMaxClockOfPState API to report the min and max clocks of some clock domain for a given PState.
|
||||
* - Added \ref nvmlDeviceGetSupportedPerformanceStates API to get all supported Performance States (P-States) for the GPU.
|
||||
* - Added \ref nvmlDeviceGetGpcClkVfOffset API to report the GPCCLK VF offset value.
|
||||
* - Added \ref nvmlDeviceGetMinMaxFanSpeed API to report the min and max fan speed that user can set for a specified GPU fan.
|
||||
*
|
||||
*
|
||||
* \section changelog19 Changes between NVML v495 Update and v510 ===
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetGpuInstanceProfileInfoV and \ref nvmlGpuInstanceGetComputeInstanceProfileInfoV APIs to include the profile name in their output.
|
||||
* - Added \ref nvmlDeviceGetMemoryBusWidth API to report the GPU's Memory Bus Width.
|
||||
* - Added \ref nvmlDeviceGetPcieLinkMaxSpeed API to report the GPU's PCIe Max Speed.
|
||||
* - Added \ref nvmlDeviceGetPowerSource API to report the GPU's power source as AC or battery.
|
||||
* - Added \ref nvmlDeviceGetNumFans API to report the GPU's number of fans.
|
||||
* - Added \ref nvmlDeviceGetNumGpuCores API to report the GPU's number of cores.
|
||||
* - Added \ref nvmlDeviceGetMemoryInfo_v2. The new version accounts separately for system-reserved memory, and includes it in the used memory amount. The previous version of the API reduced the total memory amount by the amount of system-reserved memory.
|
||||
* - Added \ref nvmlDeviceGetAdaptiveClockInfoStatus API to report the status of adaptive clocking for the GPU.
|
||||
*
|
||||
*
|
||||
* \section changelog18 Changes between NVML v465 Update and v470 ===
|
||||
*
|
||||
* - Added new MIG GPU instance profile NVML_GPU_INSTANCE_PROFILE_1_SLICE_REV1.
|
||||
* - Added \ref nvmlDeviceGetGpuInstancePossiblePlacements_v2. The previous version of the API will not support the profiles with possible placements greater than its total capacity, such as NVML_GPU_INSTANCE_PROFILE_1_SLICE_REV1.
|
||||
*
|
||||
*
|
||||
* \section changelog17 Changes between NVML v460 Update and v465 ===
|
||||
*
|
||||
* - Added new NVML_BRAND_* enumeration values for NVIDIA, NVIDIA_RTX, GEFORCE_RTX, QUADRO_RTX and TITAN_RTX
|
||||
* - Updated \ref nvmlDeviceGetHandleByUUID to make it MIG-aware.
|
||||
* - Updated \ref nvmlDeviceGetUUID to return MIG UUIDs in the canonical format, 'MIG-UUID'.
|
||||
* - Updated \ref nvmlDeviceGetHandleByUUID to accept both UUID formats, 'MIG-UUID' and 'MIG-GPU UUID/GID/CID'.
|
||||
* - The \ref nvmlDeviceSetAPIRestriction and \ref nvmlDeviceGetAPIRestriction APIs would no longer support the ability to toggle root-only requirement for \ref nvmlDeviceSetApplicationsClocks and \ref nvmlDeviceResetApplicationsClocks.
|
||||
*
|
||||
*
|
||||
* \section changelog16 Changes between NVML v450 Update and v460 ===
|
||||
*
|
||||
* - Added \ref nvmlDeviceCreateGpuInstanceWithPlacement to allow placement specification when creating a new MIG GPU instance.
|
||||
*
|
||||
*
|
||||
* \section changelog15 Changes between NVML v445 Update and v450 ===
|
||||
*
|
||||
* - Updated \ref nvmlDeviceGetFanSpeed and \ref nvmlDeviceGetFanSpeed_v2 for allowing fan speeds greater than 100% to be reported.
|
||||
* - Added \ref nvmlDeviceGetCpuAffinityWithinScope to determine the closest processor(s) within a NUMA node or socket.
|
||||
* - Added \ref nvmlDeviceGetMemoryAffinity to determine the closest NUMA node(s) within a NUMA node or socket.
|
||||
* - Added support to query and disable MIG mode on Windows.
|
||||
*
|
||||
*
|
||||
* \section changelog14 Changes between NVML v418 Update and v445 ===
|
||||
*
|
||||
* - Added support for NVIDIA Ampere architecture.
|
||||
* - Added support for Multi Instance GPU management. Refer "Multi Instance GPU Management" section for details.
|
||||
*
|
||||
*
|
||||
* \section changelog13 Changes between NVML v361 Update and v418
|
||||
*
|
||||
* - Support for Volta and Turing architectures, bug fixes, performance improvements, and new features
|
||||
*
|
||||
*
|
||||
* \section changelog12 Changes between NVML v349 Update and v361
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetBoardPartNumber to return GPU part numbers
|
||||
* - Removed support for exclusive thread compute mode (Deprecated in 7.5)
|
||||
* - Added NVML_CLOCK_VIDEO (encoder/decoder) clock type as a supported clock type for \ref nvmlDeviceGetClockInfo and \ref nvmlDeviceGetMaxClockInfo.
|
||||
*
|
||||
*
|
||||
* \section changelog11 Changes between NVML v346 Update and v349
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 349 Production or later
|
||||
* - Updated \ref nvmlDeviceGetMemoryInfo to report Used/Free memory under Windows WDDM mode
|
||||
* - Added \ref nvmlDeviceGetTopologyCommonAncestor to find the common path between two devices
|
||||
* - Added \ref nvmlDeviceGetTopologyNearestGpus to get a set of GPUs given a path level
|
||||
* - Added \ref nvmlSystemGetTopologyGpuSet to retrieve a set of GPUs with a given CPU affinity
|
||||
* - Updated \ref nvmlDeviceGetAccountingPids, \ref nvmlDeviceGetAccountingBufferSize and \ref nvmlDeviceGetAccountingStats to report accounting information for both active and terminated processes. The execution time field in \ref nvmlAccountingStats_t structure is populated only when the process is terminated.
|
||||
*
|
||||
*
|
||||
* \section changelog10 Changes between NVML v340 Update and v346
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 346 Production or later
|
||||
* - added the public APIs nvmlDeviceGetPcieReplayCounter and nvmlDeviceGetPcieThroughput
|
||||
* - Discontinued Perl bindings support
|
||||
* - Added \p nvmlDeviceGetGraphicsRunningProcesses_v2 to get information about Graphics processes running on a GPU.
|
||||
*
|
||||
*
|
||||
* \section changelog9 Changes between NVML v331 Update and v340
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 340 Production or later
|
||||
* - Added \ref nvmlDeviceGetSamples to get recent power, utilization and clock samples for the GPU.
|
||||
* - Added \ref nvmlDeviceGetTemperatureThreshold to retrieve temperature threshold information.
|
||||
* - Added \ref nvmlDeviceGetBrand to retrieve brand information (e.g. Tesla, Quadro, etc.)
|
||||
* - Added support for K40d and K80
|
||||
* - Added nvmlDeviceGetTopology internal API to retrieve path info between PCI devices (remove this for DITA)
|
||||
* - Added \ref nvmlDeviceGetViolationStatus to get the duration of time during which the device was throttled (lower than requested clocks) due to thermal or power constraints.
|
||||
* - Added \ref nvmlDeviceGetEncoderUtilization and \ref nvmlDeviceGetDecoderUtilization APIs
|
||||
* - Added \ref nvmlDeviceGetCpuAffinity to determine the closest processor(s) affinity to a specific GPU
|
||||
* - Added \ref nvmlDeviceSetCpuAffinity to bind a specific GPU to the closest processor
|
||||
* - Added \ref nvmlDeviceClearCpuAffinity to unbind a specific GPU
|
||||
* - Added \ref nvmlDeviceGetBoardId to get a unique boardId for the running system
|
||||
* - Added \ref nvmlDeviceGetMultiGpuBoard to get whether the device is on a multiGPU board
|
||||
* - Added \ref nvmlDeviceGetAutoBoostedClocksEnabled and nvmlDeviceSetAutoBoostedClocksEnabled for querying and setting the state of auto boosted clocks on supporting hardware.
|
||||
* - Added \ref nvmlDeviceSetDefaultAutoBoostedClocksEnabled for setting the default state of auto boosted clocks on supporting hardware.
|
||||
*
|
||||
*
|
||||
* \section changelog8 Changes between NVML v5.319 Update and v331
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 331 Production or later
|
||||
* - Added \ref nvmlDeviceGetMinorNumber to get the minor number for the device.
|
||||
* - Added \ref nvmlDeviceGetBAR1MemoryInfo to get BAR1 total, available and used memory size.
|
||||
* - Added \ref nvmlDeviceGetBridgeChipInfo to get the information related to bridge chip firmware.
|
||||
* - Added enforced power limit query API \ref nvmlDeviceGetEnforcedPowerLimit
|
||||
* - Updated \ref nvmlEventSetWait_v2 to return xid event data in case of xid error event.
|
||||
* - Added support for K8
|
||||
*
|
||||
* \section changelog7 Changes between NVML v5.319 RC and v5.319 Update
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 319 Update or later
|
||||
*
|
||||
* - Added \ref nvmlDeviceSetAPIRestriction and \ref nvmlDeviceGetAPIRestriction, with initial ability to toggle root-only requirement for \ref nvmlDeviceSetApplicationsClocks and \ref nvmlDeviceResetApplicationsClocks.
|
||||
*
|
||||
* \section changelog6 Changes between NVML v4.304 and v5.319 RC
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 319 Production or later
|
||||
*
|
||||
* - IMPORTANT: Added _v2 versions of \ref nvmlDeviceGetHandleByIndex_v2 and \ref nvmlDeviceGetCount_v2 that also count devices not accessible by current user
|
||||
* - IMPORTANT: nvmlDeviceGetHandleByIndex_v2 (default) can also return NVML_ERROR_NO_PERMISSION
|
||||
* - Added nvmlInit_v2 and nvmlDeviceGetHandleByIndex_v2 that is safer and thus recommended function for initializing the library
|
||||
* - nvmlInit_v2 lazily initializes only requested devices (queried with nvmlDeviceGetHandle*)
|
||||
* - nvml.h defines nvmlInit_v2 and nvmlDeviceGetHandleByIndex_v2 as default functions
|
||||
* - Added \ref nvmlDeviceGetIndex
|
||||
* - Added \ref NVML_ERROR_GPU_IS_LOST to report GPUs that have fallen off the bus.
|
||||
* - Note: All NVML device APIs can return this error code, as a GPU can fall off the bus at any time.
|
||||
* - Added new class of APIs for gathering process statistics (\ref nvmlAccountingStats)
|
||||
* - Application Clocks are no longer supported on GPU's from Quadro product line
|
||||
* - Added APIs to support dynamic page retirement. See \ref nvmlDeviceGetRetiredPages and
|
||||
* \ref nvmlDeviceGetRetiredPagesPendingStatus
|
||||
* - Renamed nvmlClocksThrottleReasonUserDefinedClocks to nvmlClocksThrottleReasonApplicationsClocksSetting. Old name is deprecated and can be removed in one of the next major releases.
|
||||
* - Added \ref nvmlDeviceGetDisplayActive and updated documentation to clarify how it differs from \ref nvmlDeviceGetDisplayMode
|
||||
*
|
||||
* \section changelog5 Changes between NVML v4.304 RC and v4.304 Production
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 304 Production or later
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetGpuOperationMode and \ref nvmlDeviceSetGpuOperationMode
|
||||
*
|
||||
* \section changelog4 Changes between NVML v3.295 and v4.304 RC
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 304 RC or later
|
||||
*
|
||||
* - Added \ref nvmlDeviceGetInforomConfigurationChecksum and \ref nvmlDeviceValidateInforom
|
||||
* - Added new error return value for initialization failure due to kernel module not receiving interrupts
|
||||
* - Added \ref nvmlDeviceSetApplicationsClocks, \ref nvmlDeviceGetApplicationsClock, \ref nvmlDeviceResetApplicationsClocks
|
||||
* - Added \ref nvmlDeviceGetSupportedMemoryClocks and \ref nvmlDeviceGetSupportedGraphicsClocks
|
||||
* - Added \ref nvmlDeviceGetPowerManagementLimitConstraints, \ref nvmlDeviceGetPowerManagementDefaultLimit and \ref nvmlDeviceSetPowerManagementLimit
|
||||
* - Added \ref nvmlDeviceGetInforomImageVersion
|
||||
* - Expanded \ref nvmlDeviceGetUUID to support all CUDA capable GPUs
|
||||
* - Deprecated \ref nvmlDeviceGetDetailedEccErrors in favor of \ref nvmlDeviceGetMemoryErrorCounter
|
||||
* - Added \ref NVML_MEMORY_LOCATION_TEXTURE_MEMORY to support reporting of texture memory error counters
|
||||
* - Added \ref nvmlDeviceGetCurrentClocksThrottleReasons and \ref nvmlDeviceGetSupportedClocksThrottleReasons
|
||||
* - \ref NVML_CLOCK_SM is now also reported on supported Kepler devices.
|
||||
* - Dropped support for GT200 based Tesla brand GPUs: C1060, M1060, S1070
|
||||
*
|
||||
* \section changelog3 Changes between NVML v2.285 and v3.295
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 295 or later
|
||||
*
|
||||
* - deprecated \ref nvmlDeviceGetHandleBySerial in favor of newly added \ref nvmlDeviceGetHandleByUUID
|
||||
* - Marked the input parameters of \ref nvmlDeviceGetHandleBySerial, \ref nvmlDeviceGetHandleByUUID and \ref nvmlDeviceGetHandleByPciBusId_v2 as const
|
||||
* - Added \ref nvmlDeviceOnSameBoard
|
||||
* - Added \ref nvmlConstants defines
|
||||
* - Added \ref nvmlDeviceGetMaxPcieLinkGeneration, \ref nvmlDeviceGetMaxPcieLinkWidth, \ref nvmlDeviceGetCurrPcieLinkGeneration,\ref nvmlDeviceGetCurrPcieLinkWidth
|
||||
* - Format change of \ref nvmlDeviceGetUUID output to match the UUID standard. This function will return a different value.
|
||||
* - \ref nvmlDeviceGetDetailedEccErrors will report zero for unsupported ECC error counters when a subset of ECC error counters are supported
|
||||
* \section changelog1 Changes between NVML v1.0 and v2.285
|
||||
*
|
||||
* The following new functionality is exposed on NVIDIA display drivers version 285 or later
|
||||
*
|
||||
* - Added possibility to query separately current and pending driver model with \p nvmlDeviceGetDriverModel
|
||||
* - Added API \ref nvmlDeviceGetVbiosVersion function to report VBIOS version.
|
||||
* - Added pciSubSystemId to \ref nvmlPciInfo_t struct
|
||||
* - Added API \ref nvmlErrorString function to convert error code to string
|
||||
* - Updated docs to indicate we support M2075 and C2075
|
||||
* - Added API \ref nvmlSystemGetHicVersion function to report HIC firmware version
|
||||
* - Added NVML versioning support
|
||||
* - Functions that changed API and/or size of structs have appended versioning suffix
|
||||
* (e.g. nvmlDeviceGetPciInfo_v2). Appropriate C defines have been
|
||||
* added that map old function names to the newer version of the function
|
||||
* - Added support for concurrent library usage by multiple libraries
|
||||
* - Added API \ref nvmlDeviceGetMaxClockInfo function for reporting device's clock limits
|
||||
* - Added new error code NVML_ERROR_DRIVER_NOT_LOADED used by \ref nvmlInit_v2
|
||||
* - Extended \ref nvmlPciInfo_t struct with new field: sub system id
|
||||
* - Added NVML support on Windows guest account
|
||||
* - Changed format of pciBusId string (to XXXX:XX:XX.X) of \ref nvmlPciInfo_t
|
||||
* - Parsing of busId in \ref nvmlDeviceGetHandleByPciBusId_v2 is less restrictive. You can pass 0:2:0.0 or 0000:02:00 and other variations
|
||||
* - Added API for events waiting for GPU events (Linux only) see docs of \ref nvmlEvents
|
||||
* - Added API \p nvmlDeviceGetComputeRunningProcesses_v2 and \ref nvmlSystemGetProcessName functions for looking up currently running compute applications
|
||||
* - Deprecated \ref nvmlDeviceGetPowerState in favor of \ref nvmlDeviceGetPerformanceState.
|
||||
* - Added \ref NVML_FI_DEV_POWER_REQUESTED_LIMIT to report out the power limit requested by the client.
|
||||
*/
|
||||
33
pkgs/cuda-13.0/nvml/doc/nvml_deprecation_and_removal.txt
Normal file
33
pkgs/cuda-13.0/nvml/doc/nvml_deprecation_and_removal.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
/*! @page DeprecationNotices Deprecation and/or removal notices for the NVML library
|
||||
* This chap†er lists the NVML functions marked for deprecation and/or removal. Starting from CUDA 13.1 deprecated functions will generate a compiler warning. Removed functions will return the NVML error code NVML_ERROR_DEPRECATED.
|
||||
*
|
||||
* \section depNotice1 CUDA 13.0 ===
|
||||
* The following functions are deprecated starting CUDA 13.0; they will be removed in CUDA 14.0.
|
||||
*
|
||||
* - nvmlDeviceSetApplicationsClocks
|
||||
* - nvmlDeviceGetApplicationsClock
|
||||
* - nvmlDeviceGetDefaultApplicationsClock
|
||||
* - nvmlDeviceResetApplicationsClocks
|
||||
* - nvmlDeviceGetViolationStatus
|
||||
* - nvmlVgpuInstanceGetLicenseStatus
|
||||
* - nvmlDeviceResetNvLinkUtilizationCounter
|
||||
* - nvmlDeviceFreezeNvLinkUtilizationCounter
|
||||
* - nvmlDeviceGetNvLinkUtilizationCounter
|
||||
* - nvmlDeviceGetNvLinkUtilizationControl
|
||||
* - nvmlDeviceSetNvLinkUtilizationControl
|
||||
* - nvmlDeviceSetMemClkVfOffset
|
||||
* - nvmlDeviceSetGpcClkVfOffset
|
||||
* - nvmlDeviceGetGpuFabricInfo
|
||||
* - nvmlDeviceGetDetailedEccErrors
|
||||
* - nvmlDeviceGetPowerManagementMode
|
||||
* - nvmlDeviceGetPowerState
|
||||
* - nvmlDeviceGetSupportedClocksThrottleReasons
|
||||
* - nvmlDeviceGetCurrentClocksThrottleReasons
|
||||
* - nvmlDeviceGetTemperature
|
||||
* - nvmlDeviceGetHandleBySerial
|
||||
*
|
||||
* The following data structures are deprecated starting CUDA 13.0
|
||||
*
|
||||
* - nvmlGpuFabricInfo_v2_t
|
||||
*
|
||||
*/
|
||||
87
pkgs/cuda-13.0/nvml/example/Makefile
Normal file
87
pkgs/cuda-13.0/nvml/example/Makefile
Normal file
@@ -0,0 +1,87 @@
|
||||
ARCH := $(shell getconf LONG_BIT)
|
||||
OS := $(shell cat /etc/issue)
|
||||
|
||||
ifneq (,$(wildcard /etc/redhat-release))
|
||||
RHEL_OS := $(shell cat /etc/redhat-release)
|
||||
endif
|
||||
|
||||
# Gets Driver Branch
|
||||
DRIVER_BRANCH := $(shell nvidia-smi | grep Driver | cut -f 3 -d' ' | cut -f 1 -d '.')
|
||||
|
||||
# Location of the CUDA Toolkit
|
||||
CUDA_PATH ?= "/usr/local/cuda-8.0"
|
||||
|
||||
ifeq (${ARCH},$(filter ${ARCH},32 64))
|
||||
# If correct architecture and libnvidia-ml library is not found
|
||||
# within the environment, build using the stub library
|
||||
|
||||
ifneq (,$(findstring Ubuntu,$(OS)))
|
||||
DEB := $(shell dpkg -l | grep cuda)
|
||||
ifneq (,$(findstring cuda, $(DEB)))
|
||||
NVML_LIB := /usr/lib/nvidia-$(DRIVER_BRANCH)
|
||||
else
|
||||
NVML_LIB := /lib${ARCH}
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring SUSE,$(OS)))
|
||||
RPM := $(shell rpm -qa cuda*)
|
||||
ifneq (,$(findstring cuda, $(RPM)))
|
||||
NVML_LIB := /usr/lib${ARCH}
|
||||
else
|
||||
NVML_LIB := /lib${ARCH}
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring CentOS,$(RHEL_OS)))
|
||||
RPM := $(shell rpm -qa cuda*)
|
||||
ifneq (,$(findstring cuda, $(RPM)))
|
||||
NVML_LIB := /usr/lib${ARCH}/nvidia
|
||||
else
|
||||
NVML_LIB := /lib${ARCH}
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring Red Hat,$(RHEL_OS)))
|
||||
RPM := $(shell rpm -qa cuda*)
|
||||
ifneq (,$(findstring cuda, $(RPM)))
|
||||
NVML_LIB := /usr/lib${ARCH}/nvidia
|
||||
else
|
||||
NVML_LIB := /lib${ARCH}
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring Fedora,$(RHEL_OS)))
|
||||
RPM := $(shell rpm -qa cuda*)
|
||||
ifneq (,$(findstring cuda, $(RPM)))
|
||||
NVML_LIB := /usr/lib${ARCH}/nvidia
|
||||
else
|
||||
NVML_LIB := /lib${ARCH}
|
||||
endif
|
||||
endif
|
||||
|
||||
else
|
||||
NVML_LIB := ../../lib${ARCH}/stubs/
|
||||
$(info "libnvidia-ml.so.1" not found, using stub library.)
|
||||
endif
|
||||
|
||||
ifneq (${ARCH},$(filter ${ARCH},32 64))
|
||||
$(error Unknown architecture!)
|
||||
endif
|
||||
|
||||
NVML_LIB += ../lib/
|
||||
NVML_LIB_L := $(addprefix -L , $(NVML_LIB))
|
||||
|
||||
CFLAGS := -I ../../include -I ../include
|
||||
LDFLAGS := -lnvidia-ml $(NVML_LIB_L)
|
||||
|
||||
all: example supportedVgpus
|
||||
example: example.o
|
||||
$(CC) $< $(CFLAGS) $(LDFLAGS) -o $@
|
||||
supportedVgpus: supportedVgpus.o
|
||||
$(CC) $< $(CFLAGS) $(LDFLAGS) -o $@
|
||||
clean:
|
||||
-@rm -f example.o
|
||||
-@rm -f example
|
||||
-@rm -f supportedVgpus.o
|
||||
-@rm -f supportedVgpus
|
||||
10
pkgs/cuda-13.0/nvml/example/README.txt
Normal file
10
pkgs/cuda-13.0/nvml/example/README.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
The NVIDIA GDK provides a simple example program that shows how to build an
|
||||
NVML client. When running an NVML client while the GDK is installed, be
|
||||
sure your library path first includes the actual NVML library (installed
|
||||
with the driver), not the stub library that exists solely for
|
||||
compilation on systems without an NVIDIA driver available.
|
||||
|
||||
If you have installed this example code via your packaging system,
|
||||
you should first copy it to a user directory before compilation.
|
||||
The packaging system uninstall feature will not remove this directory if it
|
||||
contains new files beyond what were installed as part of the GDK.
|
||||
180
pkgs/cuda-13.0/nvml/example/example.c
Normal file
180
pkgs/cuda-13.0/nvml/example/example.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/***************************************************************************\
|
||||
|* *|
|
||||
|* Copyright 2010-2016 NVIDIA Corporation. All rights reserved. *|
|
||||
|* *|
|
||||
|* NOTICE TO USER: *|
|
||||
|* *|
|
||||
|* This source code is subject to NVIDIA ownership rights under U.S. *|
|
||||
|* and international Copyright laws. Users and possessors of this *|
|
||||
|* source code are hereby granted a nonexclusive, royalty-free *|
|
||||
|* license to use this code in individual and commercial software. *|
|
||||
|* *|
|
||||
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE *|
|
||||
|* CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR *|
|
||||
|* IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH *|
|
||||
|* REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF *|
|
||||
|* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR *|
|
||||
|* PURPOSE. IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, *|
|
||||
|* INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES *|
|
||||
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN *|
|
||||
|* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *|
|
||||
|* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE *|
|
||||
|* CODE. *|
|
||||
|* *|
|
||||
|* U.S. Government End Users. This source code is a "commercial item" *|
|
||||
|* as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting *|
|
||||
|* of "commercial computer software" and "commercial computer software *|
|
||||
|* documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) *|
|
||||
|* and is provided to the U.S. Government only as a commercial end item. *|
|
||||
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through *|
|
||||
|* 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the *|
|
||||
|* source code with only those rights set forth herein. *|
|
||||
|* *|
|
||||
|* Any use of this source code in individual and commercial software must *|
|
||||
|* include, in the user documentation and internal comments to the code, *|
|
||||
|* the above Disclaimer and U.S. Government End Users Notice. *|
|
||||
|* *|
|
||||
|* *|
|
||||
\***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <nvml.h>
|
||||
|
||||
static const char * convertToComputeModeString(nvmlComputeMode_t mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case NVML_COMPUTEMODE_DEFAULT:
|
||||
return "Default";
|
||||
case NVML_COMPUTEMODE_EXCLUSIVE_THREAD:
|
||||
return "Exclusive_Thread";
|
||||
case NVML_COMPUTEMODE_PROHIBITED:
|
||||
return "Prohibited";
|
||||
case NVML_COMPUTEMODE_EXCLUSIVE_PROCESS:
|
||||
return "Exclusive Process";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
nvmlReturn_t result;
|
||||
unsigned int device_count, i;
|
||||
|
||||
// First initialize NVML library
|
||||
result = nvmlInit();
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to initialize NVML: %s\n", nvmlErrorString(result));
|
||||
|
||||
printf("Press ENTER to continue...\n");
|
||||
getchar();
|
||||
return 1;
|
||||
}
|
||||
|
||||
result = nvmlDeviceGetCount(&device_count);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to query device count: %s\n", nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
printf("Found %u device%s\n\n", device_count, device_count != 1 ? "s" : "");
|
||||
|
||||
printf("Listing devices:\n");
|
||||
for (i = 0; i < device_count; i++)
|
||||
{
|
||||
nvmlDevice_t device;
|
||||
char name[NVML_DEVICE_NAME_BUFFER_SIZE];
|
||||
nvmlPciInfo_t pci;
|
||||
nvmlComputeMode_t compute_mode;
|
||||
|
||||
// Query for device handle to perform operations on a device
|
||||
// You can also query device handle by other features like:
|
||||
// nvmlDeviceGetHandleBySerial
|
||||
// nvmlDeviceGetHandleByPciBusId
|
||||
result = nvmlDeviceGetHandleByIndex(i, &device);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to get handle for device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
result = nvmlDeviceGetName(device, name, NVML_DEVICE_NAME_BUFFER_SIZE);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to get name of device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
// pci.busId is very useful to know which device physically you're talking to
|
||||
// Using PCI identifier you can also match nvmlDevice handle to CUDA device.
|
||||
result = nvmlDeviceGetPciInfo(device, &pci);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to get pci info for device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
printf("%u. %s [%s]\n", i, name, pci.busId);
|
||||
|
||||
// This is a simple example on how you can modify GPU's state
|
||||
result = nvmlDeviceGetComputeMode(device, &compute_mode);
|
||||
if (NVML_ERROR_NOT_SUPPORTED == result)
|
||||
printf("\t This is not CUDA capable device\n");
|
||||
else if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to get compute mode for device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
// try to change compute mode
|
||||
printf("\t Changing device's compute mode from '%s' to '%s'\n",
|
||||
convertToComputeModeString(compute_mode),
|
||||
convertToComputeModeString(NVML_COMPUTEMODE_PROHIBITED));
|
||||
|
||||
result = nvmlDeviceSetComputeMode(device, NVML_COMPUTEMODE_PROHIBITED);
|
||||
if (NVML_ERROR_NO_PERMISSION == result)
|
||||
printf("\t\t Need root privileges to do that: %s\n", nvmlErrorString(result));
|
||||
else if (NVML_ERROR_NOT_SUPPORTED == result)
|
||||
printf("\t\t Compute mode prohibited not supported. You might be running on\n"
|
||||
"\t\t windows in WDDM driver model or on non-CUDA capable GPU\n");
|
||||
else if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("\t\t Failed to set compute mode for device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\t Restoring device's compute mode back to '%s'\n",
|
||||
convertToComputeModeString(compute_mode));
|
||||
result = nvmlDeviceSetComputeMode(device, compute_mode);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("\t\t Failed to restore compute mode for device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = nvmlShutdown();
|
||||
if (NVML_SUCCESS != result)
|
||||
printf("Failed to shutdown NVML: %s\n", nvmlErrorString(result));
|
||||
|
||||
printf("All done.\n");
|
||||
|
||||
printf("Press ENTER to continue...\n");
|
||||
getchar();
|
||||
return 0;
|
||||
|
||||
Error:
|
||||
result = nvmlShutdown();
|
||||
if (NVML_SUCCESS != result)
|
||||
printf("Failed to shutdown NVML: %s\n", nvmlErrorString(result));
|
||||
|
||||
printf("Press ENTER to continue...\n");
|
||||
getchar();
|
||||
return 1;
|
||||
}
|
||||
160
pkgs/cuda-13.0/nvml/example/supportedVgpus.c
Normal file
160
pkgs/cuda-13.0/nvml/example/supportedVgpus.c
Normal file
@@ -0,0 +1,160 @@
|
||||
/***************************************************************************\
|
||||
|* *|
|
||||
|* Copyright 2010-2016 NVIDIA Corporation. All rights reserved. *|
|
||||
|* *|
|
||||
|* NOTICE TO USER: *|
|
||||
|* *|
|
||||
|* This source code is subject to NVIDIA ownership rights under U.S. *|
|
||||
|* and international Copyright laws. Users and possessors of this *|
|
||||
|* source code are hereby granted a nonexclusive, royalty-free *|
|
||||
|* license to use this code in individual and commercial software. *|
|
||||
|* *|
|
||||
|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE *|
|
||||
|* CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR *|
|
||||
|* IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH *|
|
||||
|* REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF *|
|
||||
|* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR *|
|
||||
|* PURPOSE. IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, *|
|
||||
|* INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES *|
|
||||
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN *|
|
||||
|* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *|
|
||||
|* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE *|
|
||||
|* CODE. *|
|
||||
|* *|
|
||||
|* U.S. Government End Users. This source code is a "commercial item" *|
|
||||
|* as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting *|
|
||||
|* of "commercial computer software" and "commercial computer software *|
|
||||
|* documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) *|
|
||||
|* and is provided to the U.S. Government only as a commercial end item. *|
|
||||
|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through *|
|
||||
|* 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the *|
|
||||
|* source code with only those rights set forth herein. *|
|
||||
|* *|
|
||||
|* Any use of this source code in individual and commercial software must *|
|
||||
|* include, in the user documentation and internal comments to the code, *|
|
||||
|* the above Disclaimer and U.S. Government End Users Notice. *|
|
||||
|* *|
|
||||
|* *|
|
||||
\***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <nvml.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
nvmlReturn_t result;
|
||||
unsigned int device_count, i;
|
||||
|
||||
// First initialize NVML library
|
||||
result = nvmlInit();
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to initialize NVML: %s\n", nvmlErrorString(result));
|
||||
return 1;
|
||||
}
|
||||
|
||||
result = nvmlDeviceGetCount(&device_count);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to query device count: %s\n", nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
printf("Found %u device%s\n", device_count, device_count != 1 ? "s" : "");
|
||||
printf("Listing devices:\n");
|
||||
|
||||
for (i = 0; i < device_count; i++)
|
||||
{
|
||||
nvmlDevice_t device;
|
||||
char name[NVML_DEVICE_NAME_BUFFER_SIZE];
|
||||
nvmlPciInfo_t pci;
|
||||
|
||||
// Query for device handle to perform operations on a device
|
||||
// You can also query device handle by other features like:
|
||||
// nvmlDeviceGetHandleBySerial
|
||||
// nvmlDeviceGetHandleByPciBusId
|
||||
result = nvmlDeviceGetHandleByIndex(i, &device);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to get handle for device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
result = nvmlDeviceGetName(device, name, NVML_DEVICE_NAME_BUFFER_SIZE);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to get name of device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
// pci.busId is very useful to know which device physically you're talking to
|
||||
// Using PCI identifier you can also match nvmlDevice handle to CUDA device.
|
||||
result = nvmlDeviceGetPciInfo(device, &pci);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to get pci info for device %u: %s\n", i, nvmlErrorString(result));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
printf("%u. %s [%s]\n", i, name, pci.busId);
|
||||
|
||||
// This is an example to get the supported vGPUs type names
|
||||
unsigned int vgpuCount = 0;
|
||||
nvmlVgpuTypeId_t *vgpuTypeIds = NULL;
|
||||
unsigned int j;
|
||||
|
||||
result = nvmlDeviceGetSupportedVgpus(device, &vgpuCount, NULL);
|
||||
if (NVML_ERROR_INSUFFICIENT_SIZE != result)
|
||||
goto Error;
|
||||
|
||||
if (vgpuCount != 0)
|
||||
{
|
||||
vgpuTypeIds = malloc(sizeof(nvmlVgpuTypeId_t) * vgpuCount);
|
||||
if (!vgpuTypeIds)
|
||||
{
|
||||
printf("Memory allocation of %d bytes failed \n", (int)(sizeof(*vgpuTypeIds)*vgpuCount));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
result = nvmlDeviceGetSupportedVgpus(device, &vgpuCount, vgpuTypeIds);
|
||||
if (NVML_SUCCESS != result)
|
||||
{
|
||||
printf("Failed to get the supported vGPUs with status %d \n", (int)result);
|
||||
goto Error;
|
||||
}
|
||||
|
||||
printf(" Displaying vGPU type names: \n");
|
||||
for (j = 0; j < vgpuCount; j++)
|
||||
{
|
||||
char vgpuTypeName[NVML_DEVICE_NAME_BUFFER_SIZE];
|
||||
unsigned int bufferSize = NVML_DEVICE_NAME_BUFFER_SIZE;
|
||||
|
||||
if (NVML_SUCCESS == (result = nvmlVgpuTypeGetName(vgpuTypeIds[j], vgpuTypeName, &bufferSize)))
|
||||
{
|
||||
printf(" %s\n",vgpuTypeName);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to query the vGPU type name with status %d \n", (int)result);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vgpuTypeIds)
|
||||
free(vgpuTypeIds);
|
||||
}
|
||||
|
||||
result = nvmlShutdown();
|
||||
if (NVML_SUCCESS != result)
|
||||
printf("Failed to shutdown NVML: %s\n", nvmlErrorString(result));
|
||||
|
||||
printf("All done.\n");
|
||||
return 0;
|
||||
|
||||
Error:
|
||||
result = nvmlShutdown();
|
||||
if (NVML_SUCCESS != result)
|
||||
printf("Failed to shutdown NVML: %s\n", nvmlErrorString(result));
|
||||
|
||||
return 1;
|
||||
}
|
||||
13607
pkgs/cuda-13.0/targets/x86_64-linux/include/nvml.h
Normal file
13607
pkgs/cuda-13.0/targets/x86_64-linux/include/nvml.h
Normal file
File diff suppressed because it is too large
Load Diff
BIN
pkgs/cuda-13.0/targets/x86_64-linux/lib/stubs/libnvidia-ml.a
Normal file
BIN
pkgs/cuda-13.0/targets/x86_64-linux/lib/stubs/libnvidia-ml.a
Normal file
Binary file not shown.
BIN
pkgs/cuda-13.0/targets/x86_64-linux/lib/stubs/libnvidia-ml.so
Executable file
BIN
pkgs/cuda-13.0/targets/x86_64-linux/lib/stubs/libnvidia-ml.so
Executable file
Binary file not shown.
254
pkgs/ks/dfmt.sh
Normal file
254
pkgs/ks/dfmt.sh
Normal file
@@ -0,0 +1,254 @@
|
||||
#!/bin/bash
|
||||
|
||||
get_disk_priority() {
|
||||
local disk=$1
|
||||
local disk_name=$(basename $disk)
|
||||
|
||||
if [[ $disk_name == nvme* ]]; then
|
||||
echo 1
|
||||
return
|
||||
fi
|
||||
|
||||
local rotational=$(cat /sys/block/$disk/queue/rotational 2>/dev/null)
|
||||
if [[ $rotational -eq 0 ]]; then
|
||||
echo 2
|
||||
return
|
||||
fi
|
||||
|
||||
local transport=$(lsblk -d -o NAME,TRAN /dev/$disk 2>/dev/null | grep $disk | awk '{print $2}')
|
||||
if [[ $transport == "sas" ]]; then
|
||||
echo 3
|
||||
else
|
||||
echo 4 # SATA OR OTHER
|
||||
fi
|
||||
}
|
||||
|
||||
get_disk_size() {
|
||||
local disk=$1
|
||||
cat /sys/block/$disk/size 2>/dev/null
|
||||
}
|
||||
|
||||
is_installed_node() {
|
||||
local disks=$(lsblk -d -n -o NAME,TYPE | grep disk | awk '{print $1}')
|
||||
|
||||
for disk in $disks; do
|
||||
local partitions=$(lsblk -n -o NAME /dev/$disk | grep -E "^${disk}p?[0-9]+" || true)
|
||||
|
||||
for part in $partitions; do
|
||||
local mount_point="/mnt/tmp_${part}"
|
||||
mkdir -p $mount_point 2>/dev/null
|
||||
|
||||
if mount -t ext4 -o ro /dev/$part $mount_point 2>/dev/null || \
|
||||
mount -t xfs -o ro /dev/$part $mount_point 2>/dev/null; then
|
||||
|
||||
if [[ -f $mount_point/.sunhpc-release ]]; then
|
||||
umount $mount_point
|
||||
rmdir $mount_point 2>/dev/null
|
||||
echo "yes"
|
||||
return 0
|
||||
fi
|
||||
umount $mount_point
|
||||
fi
|
||||
rmdir $mount_point 2>/dev/null
|
||||
done
|
||||
done
|
||||
|
||||
echo "no"
|
||||
}
|
||||
|
||||
select_best_disk() {
|
||||
local disks=()
|
||||
|
||||
for disk in /sys/block/*; do
|
||||
local disk_name=$(basename $disk)
|
||||
if [[ $disk_name =~ ^(loop|zram|ram|sr|fd|dm-) ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ -e /dev/$disk_name ]] && [[ $(cat /sys/block/$disk_name/removable 2>/dev/null) -eq 0 ]]; then
|
||||
disks+=($disk_name)
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#disks[@]} -eq 0 ]]; then
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
|
||||
declare -A disk_priority
|
||||
declare -A disk_size
|
||||
|
||||
for disk in "${disks[@]}"; do
|
||||
disk_priority[$disk]=$(get_disk_priority $disk)
|
||||
disk_size[$disk]=$(get_disk_size $disk)
|
||||
done
|
||||
|
||||
local sorted_disks=($(for disk in "${disks[@]}"; do
|
||||
echo "${disk_priority[$disk]}:${disk_size[$disk]}:$disk"
|
||||
done | sort -n -t: -k1,1 -k2,2rn | cut -d: -f3))
|
||||
|
||||
echo "${sorted_disks[0]}"
|
||||
}
|
||||
|
||||
# 智能计算 Root 分区大小
|
||||
# 参数: $1 = 磁盘总大小(GB), $2 = 期望的默认大小(GB)
|
||||
# 返回: 合适的 root 分区大小(GB)
|
||||
calculate_root_size() {
|
||||
local disk_total_gb=$1
|
||||
local default_root_gb=${2:-70}
|
||||
local min_root_gb=30
|
||||
local max_root_gb=100
|
||||
|
||||
# 如果磁盘总容量小于最小要求(70GB + boot + swap = 约75GB)
|
||||
if [[ $disk_total_gb -lt 75 ]]; then
|
||||
# 磁盘太小,使用最小 root 分区
|
||||
echo $min_root_gb
|
||||
elif [[ $disk_total_gb -lt 100 ]]; then
|
||||
# 磁盘在 75-100GB 之间,使用 40-50GB
|
||||
echo $((disk_total_gb - 45)) # 预留 boot+swap+state 空间
|
||||
elif [[ $disk_total_gb -lt 150 ]]; then
|
||||
# 磁盘在 100-150GB 之间,使用 60GB
|
||||
echo 60
|
||||
elif [[ $disk_total_gb -lt 250 ]]; then
|
||||
# 磁盘在 150-250GB 之间,使用默认 70GB
|
||||
echo $default_root_gb
|
||||
else
|
||||
# 大磁盘,限制最大 100GB
|
||||
echo $max_root_gb
|
||||
fi
|
||||
}
|
||||
|
||||
calculate_state_size() {
|
||||
local disk_total_sectors=$1
|
||||
local root_size_sectors=$2
|
||||
echo $((disk_total_sectors - root_size_sectors))
|
||||
}
|
||||
|
||||
get_disk_size_gb() {
|
||||
local disk=$1
|
||||
local total_sectors=$(cat /sys/block/$disk/size 2>/dev/null)
|
||||
local total_gb=$((total_sectors * 512 / 1024 / 1024 / 1024))
|
||||
echo $total_gb
|
||||
}
|
||||
|
||||
get_disk_type() {
|
||||
local disk=$1
|
||||
|
||||
if [[ $disk == nvme* ]]; then
|
||||
echo "NVMe"
|
||||
elif [[ $(cat /sys/block/$disk/queue/rotational 2>/dev/null) -eq 0 ]]; then
|
||||
echo "SSD"
|
||||
else
|
||||
local transport=$(lsblk -d -o NAME,TRAN /dev/$disk 2>/dev/null | grep $disk | awk '{print $2}')
|
||||
if [[ $transport == "sas" ]]; then
|
||||
echo "SAS"
|
||||
else
|
||||
echo "SATA"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
generate_ks_partition() {
|
||||
local disk=$1
|
||||
local is_upgrade=$2
|
||||
|
||||
# 获取磁盘总容量(扇区和GB)
|
||||
local total_sectors=$(cat /sys/block/$disk/size)
|
||||
local total_gb=$(get_disk_size_gb $disk)
|
||||
local disk_type=$(get_disk_type $disk)
|
||||
|
||||
# 智能计算 root 分区大小
|
||||
local root_gb=$(calculate_root_size $total_gb 70)
|
||||
local root_size_sectors=$((root_gb * 1024 * 1024 * 1024 / 512))
|
||||
|
||||
# 计算剩余空间给 state 分区
|
||||
local remaining_sectors=$((total_sectors - root_size_sectors))
|
||||
local remaining_gb=$((remaining_sectors * 512 / 1024 / 1024 / 1024))
|
||||
|
||||
# 计算 boot 和 swap 预留空间
|
||||
local boot_gb=1
|
||||
local swap_gb=4
|
||||
local reserved_gb=$((boot_gb + swap_gb))
|
||||
|
||||
cat << EOF
|
||||
# ==================================================
|
||||
# Disk Partition Information
|
||||
# ==================================================
|
||||
# Installation Type : $([ "$is_upgrade" == "yes" ] && echo "Upgrade" || echo "Fresh") Installation
|
||||
# Disk Device : /dev/$disk
|
||||
# Disk Type : $disk_type
|
||||
# Disk Total : $total_gb GB ($total_sectors sectors)
|
||||
#
|
||||
# Partition Plan:
|
||||
# - /boot : ${boot_gb}GB (reserved)
|
||||
# - swap : ${swap_gb}GB (reserved)
|
||||
# - / : ${root_gb}GB ($root_size_sectors sectors)
|
||||
# - /state : ${remaining_gb}GB ($remaining_sectors sectors)
|
||||
# ==================================================
|
||||
EOF
|
||||
|
||||
cat << EOF
|
||||
zerombr
|
||||
ignoredisk --only-use=$disk
|
||||
clearpart --all --initlabel
|
||||
part /boot --fstype="xfs" --size=1024 --ondisk=$disk
|
||||
part swap --fstype="swap" --size=4096 --ondisk=$disk
|
||||
part / --fstype="xfs" --size=$((root_gb * 1024)) --ondisk=$disk
|
||||
EOF
|
||||
|
||||
if [[ $is_upgrade == "yes" ]]; then
|
||||
cat << EOF
|
||||
part /state/partition1 --fstype=xfs --size=1 --grow --ondisk=$disk
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
local is_installed=$(is_installed_node)
|
||||
|
||||
if [[ $is_installed == "yes" ]]; then
|
||||
echo "# Detected: Already installed node (found .sunhpc-release)"
|
||||
local found_disk=""
|
||||
local disks=$(lsblk -d -n -o NAME,TYPE | grep disk | awk '{print $1}')
|
||||
|
||||
for disk in $disks; do
|
||||
local partitions=$(lsblk -n -o NAME /dev/$disk | grep -E "^${disk}p?[0-9]+" || true)
|
||||
for part in $partitions; do
|
||||
local mount_point="/mnt/tmp_${part}"
|
||||
mkdir -p $mount_point 2>/dev/null
|
||||
if mount -t ext4 -o ro /dev/$part $mount_point 2>/dev/null || \
|
||||
mount -t xfs -o ro /dev/$part $mount_point 2>/dev/null; then
|
||||
if [[ -f $mount_point/.sunhpc-release ]]; then
|
||||
found_disk=$disk
|
||||
umount $mount_point
|
||||
rmdir $mount_point 2>/dev/null
|
||||
break 2
|
||||
fi
|
||||
umount $mount_point
|
||||
fi
|
||||
rmdir $mount_point 2>/dev/null
|
||||
done
|
||||
done
|
||||
|
||||
if [[ -n $found_disk ]]; then
|
||||
echo "# Found existing installation on disk: /dev/$found_disk"
|
||||
generate_ks_partition $found_disk "yes"
|
||||
else
|
||||
echo "# ERROR: Cannot find disk with .sunhpc-release, using default"
|
||||
local best_disk=$(select_best_disk)
|
||||
generate_ks_partition $best_disk "yes"
|
||||
fi
|
||||
else
|
||||
echo "# Detected: Fresh installation"
|
||||
local best_disk=$(select_best_disk)
|
||||
|
||||
if [[ -z $best_disk ]]; then
|
||||
echo "# ERROR: No disk found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "# Selected best disk: /dev/$best_disk"
|
||||
generate_ks_partition $best_disk "no"
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
753
pkgs/ks/init.sh
Normal file
753
pkgs/ks/init.sh
Normal file
@@ -0,0 +1,753 @@
|
||||
#!/bin/bash
|
||||
# ============================================================================
|
||||
# Sun HPC 系统初始化脚本
|
||||
# 功能:系统安装完成后自动配置 HPC 计算节点环境
|
||||
# 版本:1.0
|
||||
# ============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
# ============================================================================
|
||||
# 配置变量(根据实际环境修改)
|
||||
# ============================================================================
|
||||
|
||||
# 日志文件
|
||||
LOG_FILE="/var/log/sunhpc-init.log"
|
||||
|
||||
FRONTEND_IP="172.16.9.254"
|
||||
|
||||
# HTTP 服务器地址
|
||||
HTTP_SERVER="http://${FRONTEND_IP}"
|
||||
|
||||
# YUM 仓库配置
|
||||
YUM_REPO_NAME="sunhpc-local"
|
||||
YUM_REPO_BASEURL="${HTTP_SERVER}/rocky/9.7"
|
||||
YUM_REPO_GPGCHECK=0
|
||||
|
||||
# 主机名映射文件(在 HTTP 服务器上)
|
||||
HOSTNAME_MAP_URL="${HTTP_SERVER}/ks/hostname-map.txt"
|
||||
|
||||
# MOTD 文件 URL
|
||||
MOTD_URL="${HTTP_SERVER}/ks/motd"
|
||||
|
||||
# NTP 服务器
|
||||
NTP_SERVER="ntp.aliyun.com"
|
||||
|
||||
# DNS 服务器
|
||||
DNS_SERVERS="114.114.114.114 223.5.5.5"
|
||||
|
||||
# ============================================================================
|
||||
# 颜色输出函数
|
||||
# ============================================================================
|
||||
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
log_info() {
|
||||
echo -e "${GREEN}[INFO]${NC} $(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOG_FILE
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "${YELLOW}[WARN]${NC} $(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOG_FILE
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOG_FILE
|
||||
}
|
||||
|
||||
log_step() {
|
||||
echo -e "${BLUE}[STEP]${NC} $(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOG_FILE
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 基础环境准备
|
||||
# ============================================================================
|
||||
|
||||
init_log() {
|
||||
# 创建日志文件
|
||||
touch $LOG_FILE
|
||||
chmod 644 $LOG_FILE
|
||||
log_info "=========================================="
|
||||
log_info "Sun HPC Node Initialization Started"
|
||||
log_info "=========================================="
|
||||
}
|
||||
|
||||
check_network() {
|
||||
log_step "Checking network connectivity..."
|
||||
|
||||
# 测试网络连接
|
||||
if ping -c 1 -W 3 172.16.9.254 &>/dev/null; then
|
||||
log_info "Network connectivity: OK"
|
||||
return 0
|
||||
else
|
||||
log_warn "Cannot reach HTTP server, will retry later"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 1. 创建 .sunhpc-release 文件
|
||||
# ============================================================================
|
||||
|
||||
create_release_file() {
|
||||
log_step "Creating .sunhpc-release file..."
|
||||
|
||||
cat > /.sunhpc-release << EOF
|
||||
Sun HPC Platform Release 1.0
|
||||
Build Date: $(date '+%Y-%m-%d %H:%M:%S')
|
||||
Hostname: $(hostname)
|
||||
Kernel: $(uname -r)
|
||||
Architecture: $(uname -m)
|
||||
EOF
|
||||
|
||||
chmod 644 /.sunhpc-release
|
||||
log_info "Created /.sunhpc-release file"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 2. 配置主机名和 /etc/hosts
|
||||
# ============================================================================
|
||||
|
||||
configure_hostname() {
|
||||
log_step "Configuring hostname and /etc/hosts..."
|
||||
|
||||
local mac=$(ip link show | grep -oP 'ether \K[0-9a-f:]+' | head -1 | tr '[:upper:]' '[:lower:]')
|
||||
local hostname=""
|
||||
|
||||
# 从 HTTP 服务器获取主机名映射
|
||||
if check_network; then
|
||||
# 下载主机名映射文件
|
||||
local map_file="/tmp/hostname-map.txt"
|
||||
curl -s -o "$map_file" "$HOSTNAME_MAP_URL" 2>/dev/null
|
||||
|
||||
if [[ -f "$map_file" ]]; then
|
||||
# 根据 MAC 地址查找主机名
|
||||
hostname=$(grep -i "$mac" "$map_file" | awk '{print $2}' | head -1)
|
||||
|
||||
# 如果没有找到,根据 IP 最后一段生成
|
||||
if [[ -z "$hostname" ]]; then
|
||||
local ip_addr=$(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -1)
|
||||
local ip_last=$(echo $ip_addr | awk -F'.' '{print $4}')
|
||||
hostname="cn$(printf "%03d" $ip_last)"
|
||||
log_warn "No hostname mapping for MAC $mac, using generated: $hostname"
|
||||
fi
|
||||
else
|
||||
log_warn "Cannot download hostname map, using default"
|
||||
local ip_addr=$(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -1)
|
||||
local ip_last=$(echo $ip_addr | awk -F'.' '{print $4}')
|
||||
hostname="cn$(printf "%03d" $ip_last)"
|
||||
fi
|
||||
else
|
||||
# 网络不通时使用默认主机名
|
||||
hostname="node-$(hostname -s)"
|
||||
fi
|
||||
|
||||
# 设置主机名
|
||||
hostnamectl set-hostname "$hostname"
|
||||
log_info "Hostname set to: $hostname"
|
||||
|
||||
# 备份原始 hosts 文件
|
||||
cp /etc/hosts /etc/hosts.bak.$(date +%Y%m%d)
|
||||
|
||||
# 构建新的 hosts 文件
|
||||
cat > /etc/hosts << EOF
|
||||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
||||
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
|
||||
|
||||
# Sun HPC Node Configuration
|
||||
$ip_addr $hostname
|
||||
|
||||
# Management Node
|
||||
$FRONTEND_IP cluster
|
||||
|
||||
# Optional: Add other compute nodes here
|
||||
# 172.16.9.1 cn001
|
||||
# 172.16.9.2 cn002
|
||||
EOF
|
||||
|
||||
# 尝试下载完整的集群 hosts 文件
|
||||
if check_network; then
|
||||
local cluster_hosts="${HTTP_SERVER}/ks/cluster-hosts.txt"
|
||||
if wget --spider -q "$cluster_hosts" 2>/dev/null; then
|
||||
wget -q -O /tmp/cluster-hosts.txt "$cluster_hosts"
|
||||
cat /tmp/cluster-hosts.txt >> /etc/hosts
|
||||
log_info "Downloaded cluster hosts configuration"
|
||||
else
|
||||
log_warn "$cluster_hosts not found on server."
|
||||
fi
|
||||
fi
|
||||
|
||||
log_info "Updated /etc/hosts"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 3. 配置 MOTD (Message of The Day)
|
||||
# ============================================================================
|
||||
|
||||
configure_motd() {
|
||||
log_step "Configuring MOTD..."
|
||||
|
||||
# 备份原始 MOTD
|
||||
if [[ -f /etc/motd ]]; then
|
||||
cp /etc/motd /etc/motd.bak.$(date +%Y%m%d)
|
||||
fi
|
||||
|
||||
# 尝试从服务器下载 MOTD
|
||||
if check_network; then
|
||||
if wget --spider -q "$MOTD_URL" 2>/dev/null; then
|
||||
wget -q -O /etc/motd "$MOTD_URL"
|
||||
log_info "Downloaded MOTD from server"
|
||||
else
|
||||
log_warn "Cannot download MOTD, creating default"
|
||||
create_default_motd
|
||||
fi
|
||||
else
|
||||
create_default_motd
|
||||
fi
|
||||
|
||||
chmod 644 /etc/motd
|
||||
}
|
||||
|
||||
create_default_motd() {
|
||||
cat > /etc/motd << EOF
|
||||
===========================================================
|
||||
Sun HPC Platform - Compute Node
|
||||
===========================================================
|
||||
Welcome to Sun High Performance Computing Cluster
|
||||
|
||||
System Information:
|
||||
--------------------
|
||||
Hostname....: $(hostname)
|
||||
IP Address..: $(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -1)
|
||||
OS Version..: $(cat /etc/redhat-release 2>/dev/null || echo "Rocky Linux")
|
||||
Kernel......: $(uname -r)
|
||||
Architecture: $(uname -m)
|
||||
CPU Cores...: $(nproc)
|
||||
Memory......: $(free -h | awk '/^Mem:/{print $2}')
|
||||
|
||||
Important URLs:
|
||||
--------------------
|
||||
• Documentation : http://172.16.9.254/docs
|
||||
• Job Submission : http://172.16.9.254/slurm
|
||||
• Monitoring: http : http://172.16.9.254/monitor
|
||||
|
||||
Slurm Commands:
|
||||
--------------------
|
||||
sinfo - View partition information
|
||||
squeue - View job queue
|
||||
srun - Run interactive job
|
||||
sbatch - Submit batch job
|
||||
scancel - Cancel job
|
||||
|
||||
===========================================================
|
||||
* Unauthorized access is prohibited
|
||||
* All activities are logged and monitored
|
||||
* For support: hpc@sun.com or ext. 12345
|
||||
===========================================================
|
||||
EOF
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 4. 配置 YUM 本地仓库
|
||||
# ============================================================================
|
||||
|
||||
configure_yum_repo() {
|
||||
log_step "Configuring YUM repository..."
|
||||
|
||||
local repo_file="/etc/yum.repos.d/${YUM_REPO_NAME}.repo"
|
||||
|
||||
# 备份现有 repo 文件
|
||||
if [[ -f "$repo_file" ]]; then
|
||||
cp "$repo_file" "${repo_file}.bak.$(date +%Y%m%d)"
|
||||
fi
|
||||
|
||||
# 创建仓库配置文件
|
||||
cat > "$repo_file" << EOF
|
||||
[${YUM_REPO_NAME}]
|
||||
name=Sun HPC Local Repository
|
||||
baseurl=${YUM_REPO_BASEURL}
|
||||
enabled=1
|
||||
gpgcheck=${YUM_REPO_GPGCHECK}
|
||||
priority=1
|
||||
EOF
|
||||
|
||||
# 如果是 Rocky 8/9,可能需要配置 appstream
|
||||
if [[ -d "/etc/yum.repos.d" ]]; then
|
||||
local appstream_repo="/etc/yum.repos.d/${YUM_REPO_NAME}-appstream.repo"
|
||||
cat > "$appstream_repo" << EOF
|
||||
[${YUM_REPO_NAME}-appstream]
|
||||
name=Sun HPC Local AppStream Repository
|
||||
baseurl=${YUM_REPO_BASEURL}-appstream
|
||||
enabled=1
|
||||
gpgcheck=${YUM_REPO_GPGCHECK}
|
||||
priority=1
|
||||
EOF
|
||||
fi
|
||||
|
||||
# 清理 YUM 缓存并测试
|
||||
yum clean all &>/dev/null
|
||||
yum makecache &>/dev/null
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
log_info "YUM repository configured successfully"
|
||||
else
|
||||
log_warn "YUM repository configured but cache generation failed (network may be down)"
|
||||
fi
|
||||
|
||||
# 显示启用的仓库
|
||||
log_info "Enabled repositories:"
|
||||
yum repolist 2>/dev/null | grep -E "^${YUM_REPO_NAME}" | tee -a $LOG_FILE
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 5. 配置 DNS 解析
|
||||
# ============================================================================
|
||||
|
||||
configure_dns() {
|
||||
log_step "Configuring DNS resolution..."
|
||||
|
||||
# 备份 resolv.conf
|
||||
cp /etc/resolv.conf /etc/resolv.conf.bak.$(date +%Y%m%d) 2>/dev/null || true
|
||||
|
||||
# 配置 DNS
|
||||
cat > /etc/resolv.conf << EOF
|
||||
# Sun HPC DNS Configuration
|
||||
nameserver ${DNS_SERVERS%% *}
|
||||
$(for dns in ${DNS_SERVERS}; do echo "nameserver $dns"; done | tail -n +2)
|
||||
|
||||
# Local domain
|
||||
search sunhpc.local local
|
||||
EOF
|
||||
|
||||
# 防止 NetworkManager 覆盖 resolv.conf
|
||||
if [[ -f /etc/NetworkManager/NetworkManager.conf ]]; then
|
||||
if ! grep -q "dns=none" /etc/NetworkManager/NetworkManager.conf; then
|
||||
sed -i '/^\[main\]/a dns=none' /etc/NetworkManager/NetworkManager.conf
|
||||
systemctl restart NetworkManager 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
log_info "DNS configured: ${DNS_SERVERS}"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 6. 配置 NTP 时间同步
|
||||
# ============================================================================
|
||||
|
||||
configure_ntp() {
|
||||
log_step "Configuring NTP time synchronization..."
|
||||
|
||||
# 使用 chrony (Rocky 8/9 默认)
|
||||
if command -v chronyd &>/dev/null; then
|
||||
# 备份配置
|
||||
cp /etc/chrony.conf /etc/chrony.conf.bak.$(date +%Y%m%d)
|
||||
|
||||
# 配置 chrony
|
||||
cat > /etc/chrony.conf << EOF
|
||||
# Sun HPC NTP Configuration
|
||||
server ${NTP_SERVER} iburst
|
||||
pool 2.rocky.pool.ntp.org iburst
|
||||
|
||||
# Record the rate at which the system clock gains/losses time.
|
||||
driftfile /var/lib/chrony/drift
|
||||
|
||||
# Allow the system clock to be stepped in the first three updates
|
||||
makestep 1.0 3
|
||||
|
||||
# Enable kernel synchronization of the real-time clock (RTC)
|
||||
rtcsync
|
||||
|
||||
# Specify file containing keys for NTP authentication
|
||||
keyfile /etc/chrony.keys
|
||||
|
||||
# Specify directory for log files
|
||||
logdir /var/log/chrony
|
||||
EOF
|
||||
|
||||
# 重启 chrony
|
||||
systemctl restart chronyd &>/dev/null
|
||||
systemctl enable chronyd &>/dev/null
|
||||
|
||||
log_info "Chrony NTP configured with server: ${NTP_SERVER}"
|
||||
else
|
||||
# 使用 ntpd (旧系统)
|
||||
if command -v ntpd &>/dev/null; then
|
||||
cat > /etc/ntp.conf << EOF
|
||||
server ${NTP_SERVER} iburst
|
||||
restrict default nomodify notrap nopeer noquery
|
||||
restrict 127.0.0.1
|
||||
restrict ::1
|
||||
driftfile /var/lib/ntp/drift
|
||||
EOF
|
||||
systemctl restart ntpd &>/dev/null
|
||||
systemctl enable ntpd &>/dev/null
|
||||
log_info "NTP configured with server: ${NTP_SERVER}"
|
||||
else
|
||||
log_warn "No NTP service found (chronyd or ntpd)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 7. 配置 SSH 服务
|
||||
# ============================================================================
|
||||
|
||||
configure_ssh() {
|
||||
log_step "Configuring SSH service..."
|
||||
|
||||
# 备份配置
|
||||
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.$(date +%Y%m%d)
|
||||
|
||||
# 优化 SSH 配置
|
||||
sed -i 's/#PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
|
||||
sed -i 's/#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
|
||||
sed -i 's/#PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
|
||||
sed -i 's/#UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
|
||||
sed -i 's/#GSSAPIAuthentication.*/GSSAPIAuthentication no/' /etc/ssh/sshd_config
|
||||
|
||||
# 重启 SSH 服务
|
||||
systemctl restart sshd &>/dev/null
|
||||
|
||||
log_info "SSH service configured"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 8. 配置防火墙
|
||||
# ============================================================================
|
||||
|
||||
configure_firewall() {
|
||||
log_step "Configuring firewall..."
|
||||
|
||||
# 检查 firewalld 是否运行
|
||||
if systemctl is-active firewalld &>/dev/null; then
|
||||
# 开放常用端口
|
||||
firewall-cmd --permanent --add-service=ssh &>/dev/null
|
||||
firewall-cmd --permanent --add-service=dhcp &>/dev/null
|
||||
firewall-cmd --permanent --add-port=873/tcp &>/dev/null # rsync
|
||||
firewall-cmd --permanent --add-port=111/udp &>/dev/null # rpcbind
|
||||
|
||||
# 重新加载
|
||||
firewall-cmd --reload &>/dev/null
|
||||
|
||||
log_info "Firewall configured"
|
||||
else
|
||||
log_warn "Firewalld not running, skipping configuration"
|
||||
fi
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 9. 安装常用软件包
|
||||
# ============================================================================
|
||||
|
||||
install_packages() {
|
||||
log_step "Installing common packages..."
|
||||
|
||||
local packages=(
|
||||
wget curl vim nano
|
||||
htop iotop iftop
|
||||
net-tools bind-utils
|
||||
telnet nc tcpdump
|
||||
rsync tree lsof
|
||||
gcc make autoconf automake
|
||||
openssl-devel zlib-devel
|
||||
nfs-utils cifs-utils
|
||||
ntpdate
|
||||
)
|
||||
|
||||
if check_network; then
|
||||
for pkg in "${packages[@]}"; do
|
||||
if rpm -q "$pkg" &>/dev/null; then
|
||||
log_info "Package already installed: $pkg"
|
||||
else
|
||||
log_info "Installing package: $pkg"
|
||||
yum install -y "$pkg" &>> $LOG_FILE || log_warn "Failed to install: $pkg"
|
||||
fi
|
||||
done
|
||||
else
|
||||
log_warn "Network unavailable, skipping package installation"
|
||||
fi
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 11. 配置用户环境
|
||||
# ============================================================================
|
||||
|
||||
configure_user_env() {
|
||||
log_step "Configuring user environment..."
|
||||
|
||||
# 创建共享目录
|
||||
mkdir -p /share/{apps,home}
|
||||
mkdir -p /state/partition1/{tmp,work}
|
||||
|
||||
# 设置权限
|
||||
chmod 755 /share
|
||||
chmod 1777 /state/partition1/tmp
|
||||
|
||||
# 配置全局环境变量
|
||||
cat > /etc/profile.d/sunhpc.sh << 'EOF'
|
||||
# Sun HPC Environment Variables
|
||||
export SHARE_HOME=/share
|
||||
export STATE_HOME=/state/partition1
|
||||
EOF
|
||||
|
||||
chmod 644 /etc/profile.d/sunhpc.sh
|
||||
log_info "User environment configured"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 12. 配置系统优化参数
|
||||
# ============================================================================
|
||||
|
||||
configure_sysctl() {
|
||||
log_step "Configuring system optimization..."
|
||||
|
||||
cat > /etc/sysctl.d/99-sunhpc.conf << EOF
|
||||
# Sun HPC System Optimization
|
||||
|
||||
# Network optimization
|
||||
net.core.rmem_max = 134217728
|
||||
net.core.wmem_max = 134217728
|
||||
net.ipv4.tcp_rmem = 4096 87380 134217728
|
||||
net.ipv4.tcp_wmem = 4096 65536 134217728
|
||||
net.core.netdev_max_backlog = 5000
|
||||
net.ipv4.tcp_max_syn_backlog = 8192
|
||||
net.ipv4.tcp_sack = 1
|
||||
net.ipv4.tcp_timestamps = 1
|
||||
|
||||
# Memory optimization
|
||||
vm.swappiness = 10
|
||||
vm.dirty_ratio = 30
|
||||
vm.dirty_background_ratio = 5
|
||||
vm.vfs_cache_pressure = 50
|
||||
|
||||
# File system
|
||||
fs.file-max = 1048576
|
||||
fs.inotify.max_user_watches = 1048576
|
||||
|
||||
# Process scheduler
|
||||
kernel.sched_autogroup_enabled = 0
|
||||
kernel.sched_migration_cost_ns = 5000000
|
||||
EOF
|
||||
|
||||
sysctl -p /etc/sysctl.d/99-sunhpc.conf &>/dev/null
|
||||
log_info "System optimization configured"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 13. 配置系统限制
|
||||
# ============================================================================
|
||||
|
||||
configure_limits() {
|
||||
log_step "Configuring system limits..."
|
||||
|
||||
cat > /etc/security/limits.d/99-sunhpc.conf << EOF
|
||||
# Sun HPC System Limits
|
||||
* soft nofile 1048576
|
||||
* hard nofile 1048576
|
||||
* soft nproc 131072
|
||||
* hard nproc 131072
|
||||
* soft memlock unlimited
|
||||
* hard memlock unlimited
|
||||
root soft nofile 1048576
|
||||
root hard nofile 1048576
|
||||
EOF
|
||||
|
||||
log_info "System limits configured"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 14. 配置定时任务
|
||||
# ============================================================================
|
||||
|
||||
configure_crontab() {
|
||||
log_step "Configuring cron jobs..."
|
||||
|
||||
cat > /etc/cron.d/sunhpc << EOF
|
||||
# Sun HPC Cron Jobs
|
||||
|
||||
# Sync time every hour
|
||||
0 * * * * root /usr/sbin/chronyc -a makestep &>/dev/null
|
||||
|
||||
# Clean old logs daily
|
||||
0 2 * * * root find /var/log -name "*.log" -mtime +30 -delete 2>/dev/null
|
||||
|
||||
# Report node status every 5 minutes
|
||||
*/5 * * * * root /usr/local/bin/node-status-report &>/dev/null
|
||||
EOF
|
||||
|
||||
chmod 644 /etc/cron.d/sunhpc
|
||||
log_info "Cron jobs configured"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 15. 创建节点状态上报脚本
|
||||
# ============================================================================
|
||||
|
||||
create_report_script() {
|
||||
log_step "Creating node status report script..."
|
||||
|
||||
cat > /usr/local/bin/node-status-report << 'EOF'
|
||||
#!/bin/bash
|
||||
# Node status report script for Sun HPC
|
||||
|
||||
HTTP_SERVER="http://172.16.9.254"
|
||||
NODE_NAME=$(hostname)
|
||||
IP_ADDR=$(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -1)
|
||||
LOAD_AVG=$(uptime | awk -F'load average:' '{print $2}' | cut -d, -f1)
|
||||
MEM_TOTAL=$(free -g | awk '/^Mem:/{print $2}')
|
||||
MEM_USED=$(free -g | awk '/^Mem:/{print $3}')
|
||||
DISK_USED=$(df -h / | awk 'NR==2{print $5}' | sed 's/%//')
|
||||
SLURM_STATUS=$(systemctl is-active slurm-slurmd 2>/dev/null || echo "unknown")
|
||||
|
||||
# Build status JSON
|
||||
STATUS_JSON="{\"node\":\"$NODE_NAME\",\"ip\":\"$IP_ADDR\",\"load\":$LOAD_AVG,\"mem_total\":$MEM_TOTAL,\"mem_used\":$MEM_USED,\"disk_used\":$DISK_USED,\"slurm\":\"$SLURM_STATUS\",\"timestamp\":\"$(date -Iseconds)\"}"
|
||||
|
||||
# Send to management node
|
||||
curl -s -X POST -H "Content-Type: application/json" -d "$STATUS_JSON" ${HTTP_SERVER}/api/node-status &>/dev/null
|
||||
EOF
|
||||
|
||||
chmod +x /usr/local/bin/node-status-report
|
||||
log_info "Node status report script created"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 16. 配置日志轮转
|
||||
# ============================================================================
|
||||
|
||||
configure_logrotate() {
|
||||
log_step "Configuring log rotation..."
|
||||
|
||||
cat > /etc/logrotate.d/sunhpc << EOF
|
||||
/var/log/sunhpc-init.log {
|
||||
daily
|
||||
rotate 30
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
create 644 root root
|
||||
}
|
||||
EOF
|
||||
|
||||
log_info "Log rotation configured"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 17. 清理临时文件
|
||||
# ============================================================================
|
||||
|
||||
cleanup() {
|
||||
log_step "Cleaning up temporary files..."
|
||||
|
||||
# 删除临时文件
|
||||
rm -f /tmp/hostname-map.txt 2>/dev/null
|
||||
rm -f /tmp/cluster-hosts.txt 2>/dev/null
|
||||
|
||||
# 清除 YUM 缓存
|
||||
yum clean all &>/dev/null
|
||||
|
||||
log_info "Cleanup completed"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 18. 生成初始化完成报告
|
||||
# ============================================================================
|
||||
|
||||
generate_report() {
|
||||
log_step "Generating initialization report..."
|
||||
|
||||
cat > /root/init-report.txt << EOF
|
||||
===========================================
|
||||
Sun HPC Node Initialization Report
|
||||
===========================================
|
||||
Init Time: $(date '+%Y-%m-%d %H:%M:%S')
|
||||
Hostname: $(hostname)
|
||||
IP Address: $(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -1)
|
||||
MAC Address: $(ip link show | grep -oP 'ether \K[0-9a-f:]+' | head -1)
|
||||
|
||||
Services Status:
|
||||
- NetworkManager: $(systemctl is-active NetworkManager)
|
||||
- chronyd: $(systemctl is-active chronyd 2>/dev/null || echo "stopped")
|
||||
- sshd: $(systemctl is-active sshd)
|
||||
- slurm-slurmd: $(systemctl is-active slurm-slurmd 2>/dev/null || echo "stopped")
|
||||
- firewalld: $(systemctl is-active firewalld)
|
||||
|
||||
YUM Repositories:
|
||||
$(yum repolist)
|
||||
|
||||
Files Created:
|
||||
- /.sunhpc-release
|
||||
- /etc/hosts (updated)
|
||||
- /etc/motd (updated)
|
||||
- /etc/yum.repos.d/sunhpc-local.repo
|
||||
- /etc/chrony.conf (updated)
|
||||
- /etc/security/limits.d/99-sunhpc.conf
|
||||
- /etc/sysctl.d/99-sunhpc.conf
|
||||
|
||||
===========================================
|
||||
EOF
|
||||
|
||||
cat /root/init-report.txt >> $LOG_FILE
|
||||
log_info "Initialization report saved to /root/init-report.txt"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 主函数
|
||||
# ============================================================================
|
||||
|
||||
main() {
|
||||
log_info "Starting Sun HPC node initialization..."
|
||||
|
||||
# 执行所有初始化步骤
|
||||
init_log
|
||||
check_network
|
||||
create_release_file
|
||||
configure_hostname
|
||||
configure_motd
|
||||
configure_yum_repo
|
||||
configure_dns
|
||||
configure_ntp
|
||||
configure_ssh
|
||||
configure_firewall
|
||||
install_packages
|
||||
configure_slurm
|
||||
configure_user_env
|
||||
configure_sysctl
|
||||
configure_limits
|
||||
configure_crontab
|
||||
create_report_script
|
||||
configure_logrotate
|
||||
cleanup
|
||||
generate_report
|
||||
|
||||
log_info "=========================================="
|
||||
log_info "Sun HPC node initialization completed!"
|
||||
log_info "=========================================="
|
||||
|
||||
# 显示关键信息
|
||||
echo ""
|
||||
echo -e "${GREEN}=== Initialization Complete ===${NC}"
|
||||
echo -e "Hostname: $(hostname)"
|
||||
echo -e "Release file: $(cat /.sunhpc-release | head -1)"
|
||||
echo -e "Log file: $LOG_FILE"
|
||||
echo -e "Report: /root/init-report.txt"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# 脚本入口
|
||||
# ============================================================================
|
||||
|
||||
# 检查是否需要重启
|
||||
if [[ "$1" == "--reboot" ]]; then
|
||||
main
|
||||
log_info "Rebooting in 5 seconds..."
|
||||
sleep 5
|
||||
reboot
|
||||
else
|
||||
main
|
||||
log_info "Initialization completed. You may reboot if needed."
|
||||
fi
|
||||
21
pkgs/ks/ipxe.sh
Normal file
21
pkgs/ks/ipxe.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!ipxe
|
||||
|
||||
:main_menu
|
||||
menu iPXE boot menu
|
||||
|
||||
item rocky9 Install Rocky Linux 9
|
||||
item local Boot from Local Disk
|
||||
|
||||
choose --default rocky9 --timeout 5000 selected || goto local
|
||||
|
||||
:rocky9
|
||||
echo Booting RockyLinux from networking
|
||||
kernel http://172.16.9.254/rocky/9.7/isolinux/vmlinuz \
|
||||
net.ifnames=0 biosdevname=0 \
|
||||
inst.repo=http://172.16.9.254/rocky/9.7 \
|
||||
inst.ks=http://172.16.9.254/ks/rhel.ks
|
||||
initrd http://172.16.9.254/rocky/9.7/isolinux/initrd.img
|
||||
boot
|
||||
|
||||
:local
|
||||
exit
|
||||
60
pkgs/ks/rhel.ks
Normal file
60
pkgs/ks/rhel.ks
Normal file
@@ -0,0 +1,60 @@
|
||||
graphical
|
||||
|
||||
%addon com_redhat_kdump --disable
|
||||
%end
|
||||
|
||||
timezone Asia/Shanghai --utc
|
||||
keyboard --xlayouts='us'
|
||||
lang en_US.UTF-8
|
||||
|
||||
selinux --disabled
|
||||
|
||||
url --url="http://172.16.9.254/rocky/9.7"
|
||||
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=link --ipv6=auto --activate
|
||||
|
||||
# Partition clearing information
|
||||
#zerombr
|
||||
#clearpart --all --initlabel
|
||||
#autopart --type=lvm
|
||||
%include /tmp/diskinfo
|
||||
|
||||
#ignoredisk --only-use=sda
|
||||
#part /boot --fstype="xfs" --ondisk=sda --size=1024
|
||||
#part swap --fstype="swap" --ondisk=sda --size=4096
|
||||
#part / --fstype="xfs" --ondisk=sda --size=97278
|
||||
#part /home --fstype="xfs" --ondisk=sda --size=20480
|
||||
|
||||
%packages
|
||||
@^minimal-environment
|
||||
@standard
|
||||
@development
|
||||
vim
|
||||
wget
|
||||
curl
|
||||
autofs
|
||||
nfs-utils
|
||||
nfs4-acl-tools
|
||||
sssd-nfs-idmap
|
||||
pcp-pmda-nfsclient
|
||||
%end
|
||||
|
||||
# Root password
|
||||
rootpw --iscrypted $6$muqhPjb0F9IM2/Fg$pPaVF7DTjs/zz91vHMrcL8jPLQoLFCjUUxHkIZao9C6OFbBPof2AtmTRfvO4Ix.8al3dnMz8/aAbd88sHSQTK.
|
||||
user --name=kelvin --password=$6$kAz6MRJFIpIyhKuv$YZntcNpyoSYRMD6y5qmZIIBiklzaskqHWE4A0oXI8vX492bcL/.z6xF3MjVDgVJzZ0FaNDSy8BFeEhD9mfr67/ --iscrypted --gecos="kelvin"
|
||||
|
||||
#reboot
|
||||
|
||||
%pre --interpreter=/bin/bash
|
||||
curl -o /tmp/dfmt.sh http://172.16.9.254/ks/dfmt.sh
|
||||
chmod +x /tmp/dfmt.sh
|
||||
|
||||
/tmp/dfmt.sh > /tmp/diskinfo
|
||||
%end
|
||||
|
||||
%post
|
||||
curl -s -o /tmp/init.sh http://172.16.9.254/ks/init.sh
|
||||
chmod +x /tmp/init.sh
|
||||
/tmp/init.sh
|
||||
%end
|
||||
BIN
pkgs/pxelinux/tftpboot/boot/bootx64.efi
Executable file
BIN
pkgs/pxelinux/tftpboot/boot/bootx64.efi
Executable file
Binary file not shown.
BIN
pkgs/pxelinux/tftpboot/boot/undionly.kpxe
Normal file
BIN
pkgs/pxelinux/tftpboot/boot/undionly.kpxe
Normal file
Binary file not shown.
Reference in New Issue
Block a user