code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def BuildCmd(server_ip, server_port, num_instances, options):
"""Build base mutilate command in a list."""
server_ips = []
for idx in range(num_instances):
server_ips.append(f'--server={server_ip}:{server_port + idx}')
cmd = (
[
'ulimit -n 32768; ',
MUTILATE_BIN,
'--keysi... | Build base mutilate command in a list. | BuildCmd | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/mutilate.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mutilate.py | Apache-2.0 |
def Run(vms, server_ip, server_port, num_instances):
"""Runs the mutilate benchmark on the vm."""
samples = []
master = vms[0]
runtime_options = {}
samples = []
measure_flags = []
additional_flags = ['--%s' % option for option in FLAGS.mutilate_options]
if FLAGS.mutilate_measure_connections:
runtim... | Runs the mutilate benchmark on the vm. | Run | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/mutilate.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mutilate.py | Apache-2.0 |
def ParseResults(result, metadata):
"""Parse mutilate result into samples.
Sample Output:
#type avg min 1st 5th 10th 90th 95th 99th
read 52.4 41.0 43.1 45.2 48.1 55.8 56.6 71.5
update 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
o... | Parse mutilate result into samples.
Sample Output:
#type avg min 1st 5th 10th 90th 95th 99th
read 52.4 41.0 43.1 45.2 48.1 55.8 56.6 71.5
update 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
op_q 1.5 1.0 1.0 1.1 ... | ParseResults | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/mutilate.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mutilate.py | Apache-2.0 |
def GetEnvironmentVars(vm):
"""Return a string containing MXNet-related environment variables.
Args:
vm: vm to get environment varibles
Returns:
string of environment variables
"""
output, _ = vm.RemoteCommand('getconf LONG_BIT')
long_bit = output.strip()
lib_name = 'lib' if long_bit == '32' els... | Return a string containing MXNet-related environment variables.
Args:
vm: vm to get environment varibles
Returns:
string of environment variables
| GetEnvironmentVars | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/mxnet.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mxnet.py | Apache-2.0 |
def GetMXNetVersion(vm):
"""Returns the version of MXNet installed on the vm.
Args:
vm: the target vm on which to check the MXNet version
Returns:
installed python MXNet version as a string
"""
stdout, _ = vm.RemoteCommand(
'echo -e "import mxnet\nprint(mxnet.__version__)" | {} python'.format(... | Returns the version of MXNet installed on the vm.
Args:
vm: the target vm on which to check the MXNet version
Returns:
installed python MXNet version as a string
| GetMXNetVersion | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/mxnet.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mxnet.py | Apache-2.0 |
def ConfigureSystemSettings(vm: virtual_machine.VirtualMachine):
"""Percona system settings.
These system settings are what Percona (consulting firm) applies to
the mysql instances that they build for their customers.
Currently tested for centos_stream9 and Ubuntu only.
Args:
vm: The VM to configure.
... | Percona system settings.
These system settings are what Percona (consulting firm) applies to
the mysql instances that they build for their customers.
Currently tested for centos_stream9 and Ubuntu only.
Args:
vm: The VM to configure.
| ConfigureSystemSettings | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/mysql80.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mysql80.py | Apache-2.0 |
def UpdatePassword(vm: virtual_machine.VirtualMachine, new_password: str):
"""Update the password of the root user."""
log_path = GetOSDependentDefaults(vm.OS_TYPE)[MYSQL_LOG_PATH]
password = vm.RemoteCommand(
f'sudo grep "A temporary password" {log_path} | '
'sed "s/.*generated for root@localhost: //... | Update the password of the root user. | UpdatePassword | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/mysql80.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mysql80.py | Apache-2.0 |
def _Build(vm):
"""Installs the NCCL package on the VM."""
vm.RemoteCommand(
'[ -d "nccl" ] || git clone {git_repo} --branch {version}'.format(
git_repo=GIT_REPO, version=FLAGS.nccl_version
)
)
cuda_home = cuda_toolkit.CUDA_HOME
vm.InstallPackages('build-essential devscripts debhelper fa... | Installs the NCCL package on the VM. | _Build | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nccl.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nccl.py | Apache-2.0 |
def Install(vm):
"""Installs nccl-test on the VM."""
env = ''
if FLAGS.aws_efa:
env = (
'export LD_LIBRARY_PATH=/opt/amazon/efa/lib:/opt/amazon/efa/lib64:'
'$LD_LIBRARY_PATH &&'
)
if FLAGS.azure_infiniband:
vm.Install('mofed')
vm.Install('cuda_toolkit')
vm.Install('nccl')
vm.In... | Installs nccl-test on the VM. | Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nccl_tests.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nccl_tests.py | Apache-2.0 |
def _Install(vm):
"""Installs the netperf package on the VM."""
vm.Install('pip')
vm.RemoteCommand('sudo pip3 install absl-py')
vm.Install('build_tools')
_CopyTar(vm)
vm.RemoteCommand(f'cd {linux_packages.INSTALL_DIR} && tar xvzf {NETPERF_TAR}')
# Modify netperf to print out all buckets in its histogram ... | Installs the netperf package on the VM. | _Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/netperf.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/netperf.py | Apache-2.0 |
def _CopyTar(vm):
"""Copy the tar file for installation.
Args:
vm: the target vm to copy the tar file to.
Tries local data directory first, then NET_PERF_URL
"""
# Kubernetes VMs sometimes fail to copy the whole archive
if (
vm.CLOUD != provider_info.KUBERNETES
and vm.PLATFORM != provider... | Copy the tar file for installation.
Args:
vm: the target vm to copy the tar file to.
Tries local data directory first, then NET_PERF_URL
| _CopyTar | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/netperf.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/netperf.py | Apache-2.0 |
def ParseHistogram(netperf_stdout):
"""Parses the histogram output from netperf.
Args:
netperf_stdout: string. The stdout from netperf containing a histogram.
Returns:
A dict mapping latency to sample count or None if the output did not
contain a histogram.
"""
# Here is an example of a netperf ... | Parses the histogram output from netperf.
Args:
netperf_stdout: string. The stdout from netperf containing a histogram.
Returns:
A dict mapping latency to sample count or None if the output did not
contain a histogram.
| ParseHistogram | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/netperf.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/netperf.py | Apache-2.0 |
def YumInstall(vm: virtual_machine.BaseVirtualMachine) -> None:
"""Install Neuron Drivers and tools.
Args:
vm: The virtual machine to install Neuron drivers and tools.
"""
# Configure Linux for Neuron repository updates
vm.RemoteCommand("""sudo tee /etc/yum.repos.d/neuron.repo > /dev/null <<EOF
[neuron]
... | Install Neuron Drivers and tools.
Args:
vm: The virtual machine to install Neuron drivers and tools.
| YumInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/neuron.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/neuron.py | Apache-2.0 |
def _Install(vm):
"""Installs the node.js package on the VM."""
vm.Install('build_tools')
vm.RemoteCommand('git clone {} {}'.format(GIT_REPO, NODE_DIR))
vm.RemoteCommand('cd {} && git checkout {}'.format(NODE_DIR, GIT_TAG))
vm.RemoteCommand('cd {} && ./configure --prefix=/usr'.format(NODE_DIR))
vm.RemoteCom... | Installs the node.js package on the VM. | _Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/node_js.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/node_js.py | Apache-2.0 |
def _ParseNuma(vm, regex: Union[str, Pattern[str]]) -> Dict[int, str]:
"""Parses the numactl --hardware output with the supplied regex."""
out, _ = vm.RemoteCommand('numactl --hardware')
matches = regex_util.ExtractAllMatches(regex, out)
return {int(m[0]): m[1] for m in matches} | Parses the numactl --hardware output with the supplied regex. | _ParseNuma | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/numactl.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/numactl.py | Apache-2.0 |
def GetNuma(vm) -> Dict[int, int]:
"""Get NUMA CPU topology of the VM that only includes the available nodes.
This method provides the number of available vCPUs on each NUMA node.
While counting, it filters out the vCPUs that are not available to the current
process. For example: if there are 16 vCPUs in a NUM... | Get NUMA CPU topology of the VM that only includes the available nodes.
This method provides the number of available vCPUs on each NUMA node.
While counting, it filters out the vCPUs that are not available to the current
process. For example: if there are 16 vCPUs in a NUMA node, but only 8 vCPUs
are available... | GetNuma | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/numactl.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/numactl.py | Apache-2.0 |
def GetNumaMemory(vm) -> Dict[int, int]:
"""Get NUMA memory topology of the VM.
Args:
vm: VirtualMachine.
Returns:
A dictionary, key is the numa node, value is the size in megabytes of
the memory on that node
"""
return {
node: int(value)
for node, value in _ParseNuma(vm, NUMA_MEMORY... | Get NUMA memory topology of the VM.
Args:
vm: VirtualMachine.
Returns:
A dictionary, key is the numa node, value is the size in megabytes of
the memory on that node
| GetNumaMemory | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/numactl.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/numactl.py | Apache-2.0 |
def AptInstall(vm):
"""Installs the nvidia-docker package on the VM."""
if CheckNvidiaDockerExists(vm):
return
vm.Install('docker')
vm.RemoteCommand(
'curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey '
'| sudo apt-key add -'
)
vm.RemoteCommand(
'curl -s -L https://nvidia.github... | Installs the nvidia-docker package on the VM. | AptInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_docker.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_docker.py | Apache-2.0 |
def CheckNvidiaGpuExists(vm):
"""Returns whether NVIDIA GPU exists or not on the vm.
Args:
vm: The virtual machine to check.
Returns:
True or False depending on whether NVIDIA GPU exists.
"""
# PKB only supports NVIDIA driver on DEBIAN for now.
if vm.BASE_OS_TYPE != os_types.DEBIAN:
return Fal... | Returns whether NVIDIA GPU exists or not on the vm.
Args:
vm: The virtual machine to check.
Returns:
True or False depending on whether NVIDIA GPU exists.
| CheckNvidiaGpuExists | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def CheckNvidiaSmiExists(vm):
"""Returns whether nvidia-smi is installed or not on a VM.
Args:
vm: The virtual to check.
Returns:
True or False depending on whether nvidia-smi command exists.
"""
# PKB only supports NVIDIA driver on DEBIAN for now.
if (
vm.BASE_OS_TYPE != os_types.DEBIAN
... | Returns whether nvidia-smi is installed or not on a VM.
Args:
vm: The virtual to check.
Returns:
True or False depending on whether nvidia-smi command exists.
| CheckNvidiaSmiExists | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def GetDriverVersion(vm):
"""Returns the NVIDIA driver version as a string.
Args:
vm: Virtual machine to query.
Returns:
String containing NVIDIA driver version installed.
Raises:
NvidiaSmiParseOutputError: If nvidia-smi output cannot be parsed.
"""
stdout, _ = vm.RemoteCommand('nvidia-smi')
... | Returns the NVIDIA driver version as a string.
Args:
vm: Virtual machine to query.
Returns:
String containing NVIDIA driver version installed.
Raises:
NvidiaSmiParseOutputError: If nvidia-smi output cannot be parsed.
| GetDriverVersion | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def GetGpuType(vm):
"""Return the type of NVIDIA gpu(s) installed on the vm.
Args:
vm: Virtual machine to query.
Returns:
Type of gpus installed on the vm as a string.
Raises:
NvidiaSmiParseOutputError: If nvidia-smi output cannot be parsed.
HeterogeneousGpuTypesError: If more than one gpu ty... | Return the type of NVIDIA gpu(s) installed on the vm.
Args:
vm: Virtual machine to query.
Returns:
Type of gpus installed on the vm as a string.
Raises:
NvidiaSmiParseOutputError: If nvidia-smi output cannot be parsed.
HeterogeneousGpuTypesError: If more than one gpu type is detected.
Unsup... | GetGpuType | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def GetGpuMem(vm: virtual_machine.BaseVirtualMachine) -> int:
"""Returns NVIDIA GPU memory on the system.
Args:
vm: Virtual machine to query.
Returns:
Integer indicating the NVIDIA GPU memory on the vm.
"""
stdout, _ = vm.RemoteCommand(
'sudo nvidia-smi --query-gpu=memory.total --id=0 --format... | Returns NVIDIA GPU memory on the system.
Args:
vm: Virtual machine to query.
Returns:
Integer indicating the NVIDIA GPU memory on the vm.
| GetGpuMem | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def QueryNumberOfGpus(vm):
"""Returns the number of NVIDIA GPUs on the system.
Args:
vm: Virtual machine to query.
Returns:
Integer indicating the number of NVIDIA GPUs present on the vm.
"""
stdout, _ = vm.RemoteCommand(
'sudo nvidia-smi --query-gpu=count --id=0 --format=csv'
)
return int... | Returns the number of NVIDIA GPUs on the system.
Args:
vm: Virtual machine to query.
Returns:
Integer indicating the number of NVIDIA GPUs present on the vm.
| QueryNumberOfGpus | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def GetPeerToPeerTopology(vm):
"""Returns a string specifying which GPUs can access each other via p2p.
Args:
vm: Virtual machine to operate on.
Example:
If p2p topology from nvidia-smi topo -p2p r looks like this:
0 1 2 3
0 X OK NS NS
1 OK X NS NS
2 NS NS X OK
3... | Returns a string specifying which GPUs can access each other via p2p.
Args:
vm: Virtual machine to operate on.
Example:
If p2p topology from nvidia-smi topo -p2p r looks like this:
0 1 2 3
0 X OK NS NS
1 OK X NS NS
2 NS NS X OK
3 NS NS OK X
GetTopology will... | GetPeerToPeerTopology | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def SetAndConfirmGpuClocks(vm):
"""Sets and confirms the GPU clock speed and autoboost policy.
The clock values are provided either by the gpu_pcie_bandwidth_clock_speeds
flags, or from gpu-specific defaults. If a device is queried and its
clock speed does not align with what it was just set to, an exception w... | Sets and confirms the GPU clock speed and autoboost policy.
The clock values are provided either by the gpu_pcie_bandwidth_clock_speeds
flags, or from gpu-specific defaults. If a device is queried and its
clock speed does not align with what it was just set to, an exception will
be raised.
Args:
vm: The... | SetAndConfirmGpuClocks | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def SetGpuClockSpeed(vm, memory_clock_speed, graphics_clock_speed):
"""Sets autoboost and memory and graphics clocks to the specified frequency.
Args:
vm: Virtual machine to operate on.
memory_clock_speed: Desired speed of the memory clock, in MHz.
graphics_clock_speed: Desired speed of the graphics cl... | Sets autoboost and memory and graphics clocks to the specified frequency.
Args:
vm: Virtual machine to operate on.
memory_clock_speed: Desired speed of the memory clock, in MHz.
graphics_clock_speed: Desired speed of the graphics clock, in MHz.
| SetGpuClockSpeed | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def QueryGpuClockSpeed(vm, device_id):
"""Returns the value of the memory and graphics clock.
All clock values are in MHz.
Args:
vm: Virtual machine to operate on.
device_id: Id of GPU device to query.
Returns:
Tuple of clock speeds in MHz in the form (memory clock, graphics clock).
"""
query... | Returns the value of the memory and graphics clock.
All clock values are in MHz.
Args:
vm: Virtual machine to operate on.
device_id: Id of GPU device to query.
Returns:
Tuple of clock speeds in MHz in the form (memory clock, graphics clock).
| QueryGpuClockSpeed | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def SetAutoboostDefaultPolicy(vm, autoboost_enabled):
"""Sets the autoboost policy to the specified value.
For each GPU on the VM, this function will set the autoboost policy
to the value specified by autoboost_enabled.
Args:
vm: Virtual machine to operate on.
autoboost_enabled: Bool or None. Value (if... | Sets the autoboost policy to the specified value.
For each GPU on the VM, this function will set the autoboost policy
to the value specified by autoboost_enabled.
Args:
vm: Virtual machine to operate on.
autoboost_enabled: Bool or None. Value (if any) to set autoboost policy to
| SetAutoboostDefaultPolicy | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def QueryAutoboostPolicy(vm, device_id):
"""Returns the state of autoboost and autoboost_default.
Args:
vm: Virtual machine to operate on.
device_id: Id of GPU device to query.
Returns:
Dict containing values for autoboost and autoboost_default.
Values can be True (autoboost on), False (autoboos... | Returns the state of autoboost and autoboost_default.
Args:
vm: Virtual machine to operate on.
device_id: Id of GPU device to query.
Returns:
Dict containing values for autoboost and autoboost_default.
Values can be True (autoboost on), False (autoboost off),
and None (autoboost not supported)... | QueryAutoboostPolicy | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def GetMetadata(vm):
"""Returns gpu-specific metadata as a dict.
Args:
vm: Virtual machine to operate on.
Returns:
A dict of gpu-specific metadata.
"""
clock_speeds = QueryGpuClockSpeed(vm, 0)
autoboost_policy = QueryAutoboostPolicy(vm, 0)
return {
'gpu_memory_clock': clock_speeds[0],
... | Returns gpu-specific metadata as a dict.
Args:
vm: Virtual machine to operate on.
Returns:
A dict of gpu-specific metadata.
| GetMetadata | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def Install(vm):
"""Install NVIDIA GPU driver on the vm.
Args:
vm: The virtual machine to install NVIDIA driver on.
"""
version_to_install = FLAGS.nvidia_driver_version
if not version_to_install:
logging.info('--nvidia_driver_version unset. Not installing.')
return
elif not FLAGS.nvidia_driver_... | Install NVIDIA GPU driver on the vm.
Args:
vm: The virtual machine to install NVIDIA driver on.
| Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/nvidia_driver.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/nvidia_driver.py | Apache-2.0 |
def _InstallForIntelMpi(vm) -> None:
"""Installs the omb package with IntelMPI lib on the VM."""
vm.Install('intelmpi')
txt, _ = vm.RemoteCommand(
f'{intelmpi.SourceMpiVarsCommand(vm)}; which mpicc mpicxx'
)
mpicc_path, mpicxx_path = txt.splitlines()
vm.Install('build_tools')
vm.InstallPreprovisione... | Installs the omb package with IntelMPI lib on the VM. | _InstallForIntelMpi | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _InstallForOpenMpi(vm) -> None:
"""Installs the omb package with OpenMPI lib on the VM."""
vm.Install('openmpi')
txt, _ = vm.RemoteCommand('which mpicc mpicxx')
mpicc_path, mpicxx_path = txt.splitlines()
vm.Install('build_tools')
vm.InstallPreprovisionedPackageData('omb', [_TARBALL], '.')
vm.RemoteCom... | Installs the omb package with OpenMPI lib on the VM. | _InstallForOpenMpi | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def Install(vm) -> None:
"""Installs the omb package with specified MPI lib on the VM."""
vm.AuthenticateVm()
if FLAGS.mpi_vendor == 'intel':
_InstallForIntelMpi(vm)
else:
_InstallForOpenMpi(vm) | Installs the omb package with specified MPI lib on the VM. | Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def RunBenchmark(request: RunRequest) -> Iterator[RunResult]:
"""Yields the RunResult of running the microbenchmark.
Args:
request: Run configuration.
"""
vms = request.vms
name = request.test_name
params = {}
if _NUMBER_ITERATIONS.value:
params['--iterations'] = _NUMBER_ITERATIONS.value
if _SY... | Yields the RunResult of running the microbenchmark.
Args:
request: Run configuration.
| RunBenchmark | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _RunBenchmarkWithIntelMpi(
vm,
name: str,
perhost: int,
environment: List[str],
global_environment: List[str],
number_processes: int = None,
hosts: List[Any] = None,
options: Dict[str, Any] = None,
) -> Tuple[str, str]:
"""Runs the microbenchmark using Intel MPI library."""
# Cre... | Runs the microbenchmark using Intel MPI library. | _RunBenchmarkWithIntelMpi | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _RunBenchmarkWithOpenMpi(
vm,
name: str,
perhost: int,
environment: List[str],
global_environment: List[str],
number_processes: int = None,
hosts: List[Any] = None,
options: Dict[str, Any] = None,
) -> Tuple[str, str]:
"""Runs the microbenchmark using OpenMPI library."""
# Create... | Runs the microbenchmark using OpenMPI library. | _RunBenchmarkWithOpenMpi | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _RunBenchmark(
vm,
name: str,
perhost: int,
number_processes: int = None,
hosts: List[Any] = None,
options: Dict[str, Any] = None,
) -> Tuple[str, str]:
"""Runs the microbenchmark.
Args:
vm: The headnode to run on.
name: The name of the microbenchmark.
perhost: MPI option -p... | Runs the microbenchmark.
Args:
vm: The headnode to run on.
name: The name of the microbenchmark.
perhost: MPI option -perhost. Use 0 to not set value.
number_processes: The number of mpi processes to use.
hosts: List of BaseLinuxVirtualMachines to use in the cluster.
options: Optional dict o... | _RunBenchmark | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _ParseBenchmarkMetadata(txt: str) -> Dict[str, str]:
"""Returns the metadata found in the benchmark text output.
For most benchmarks this is an empty dict. An example of acc_latency's:
{'sync': 'MPI_Win_flush', 'window_creation': 'MPI_Win_allocate'}
Args:
txt: The benchmark's text output.
"""
de... | Returns the metadata found in the benchmark text output.
For most benchmarks this is an empty dict. An example of acc_latency's:
{'sync': 'MPI_Win_flush', 'window_creation': 'MPI_Win_allocate'}
Args:
txt: The benchmark's text output.
| _ParseBenchmarkMetadata | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _LinesAfterMarker(line_re: Pattern[str], txt: str) -> List[str]:
r"""Returns the text lines after the matching regex.
_LinesAfterMarker(re.compile('^Hello'), "Line1\nHello\nLine2") == ['Line2']
Args:
line_re: Pattern to match the start of data
txt: Text input
"""
def StartBlock(line: str) -> bo... | Returns the text lines after the matching regex.
_LinesAfterMarker(re.compile('^Hello'), "Line1\nHello\nLine2") == ['Line2']
Args:
line_re: Pattern to match the start of data
txt: Text input
| _LinesAfterMarker | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _ParseBenchmarkData(
benchmark_name: str, txt: str
) -> List[Dict[str, float]]:
"""Returns the parsed metrics from the benchmark stdout.
Text for benchmark_name='bw':
# OSU MPI Bandwidth Test v5.7
# Size Bandwidth (MB/s)
1 0.48
2 0.98
Returns [{'... | Returns the parsed metrics from the benchmark stdout.
Text for benchmark_name='bw':
# OSU MPI Bandwidth Test v5.7
# Size Bandwidth (MB/s)
1 0.48
2 0.98
Returns [{'size': 1, 'bandwidth': 0.48}, {'size': 2, 'bandwidth': 0.98}]
Args:
benchmark_name: Na... | _ParseBenchmarkData | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def ParseMpiPinning(lines: Sequence[str]) -> List[str]:
"""Grabs MPI pinning to CPUs from the log files.
Output format is (rank:node id:comma separated CPUs)
0:1:0,24;1:1:1,25;2:1:2,26;3:1:3,27
Rank 0 and 1 are on node 1 and are pinned to CPUs (0,24) and (1,25)
Args:
lines: Text lines from mpirun outp... | Grabs MPI pinning to CPUs from the log files.
Output format is (rank:node id:comma separated CPUs)
0:1:0,24;1:1:1,25;2:1:2,26;3:1:3,27
Rank 0 and 1 are on node 1 and are pinned to CPUs (0,24) and (1,25)
Args:
lines: Text lines from mpirun output.
Returns:
Text strings of the MPI pinning
| ParseMpiPinning | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _CondenseMpiPinningMultiline(lines: Sequence[str]) -> Sequence[str]:
"""Returns multi-line MPI pinning info as one line."""
condensed_lines = []
for line in lines:
m = _MPI_PIN_RE.search(line)
if m:
condensed_lines.append(line)
else:
if condensed_lines and not condensed... | Returns multi-line MPI pinning info as one line. | _CondenseMpiPinningMultiline | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _IntRange(mask: str) -> List[int]:
"""Converts an integer mask into a sorted list of integers.
_IntRange('0,1,5-7') == [0, 1, 5, 6, 7]
Args:
mask: String integer mask as from MPI pinning list
Returns:
Sorted list of integers from the mask
"""
ints = []
for raw in mask.split(','):
parts ... | Converts an integer mask into a sorted list of integers.
_IntRange('0,1,5-7') == [0, 1, 5, 6, 7]
Args:
mask: String integer mask as from MPI pinning list
Returns:
Sorted list of integers from the mask
| _IntRange | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/omb.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/omb.py | Apache-2.0 |
def _Install(vm):
"""Installs the OpenBLAS package on the VM."""
vm.Install('build_tools')
vm.Install('fortran')
vm.RemoteCommand('git clone {} {}'.format(GIT_REPO, OPENBLAS_DIR))
vm.RemoteCommand('cd {} && git checkout {}'.format(OPENBLAS_DIR, GIT_TAG))
# TODO(user): By specifying TARGET= for the first com... | Installs the OpenBLAS package on the VM. | _Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openblas.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openblas.py | Apache-2.0 |
def AptInstall(vm):
"""Install OpenFOAM https://openfoam.org/download/7-ubuntu/."""
remote_key_file = '/tmp/openfoam.key'
vm.PushDataFile(_OPENFOAM_REPOSITORY_KEY, remote_key_file)
vm.RemoteCommand(f'sudo apt-key add {remote_key_file}; rm {remote_key_file}')
vm.RemoteCommand(f'sudo add-apt-repository {_OPENFO... | Install OpenFOAM https://openfoam.org/download/7-ubuntu/. | AptInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openfoam.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openfoam.py | Apache-2.0 |
def YumInstall(vm):
"""Installs the OpenJDK package on the VM."""
def OpenJdkPackage(version: str) -> str:
# TODO(pclay): Remove support for Java 8
if version == '8':
version = '1.8.0'
if (
vm.OS_TYPE == os_types.AMAZONLINUX2023
or vm.OS_TYPE == os_types.AMAZONLINUX2
):
... | Installs the OpenJDK package on the VM. | YumInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openjdk.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openjdk.py | Apache-2.0 |
def AptInstall(vm):
"""Installs Microsoft Build of OpenJDK on an Ubuntu-based VM.
Args:
vm: The VM instance where the OpenJDK should be installed.
"""
vm.RemoteCommand('ubuntu_release=$(lsb_release -rs)')
vm.RemoteCommand(
'wget https://packages.microsoft.com/config/ubuntu/${ubuntu_release}/pack... | Installs Microsoft Build of OpenJDK on an Ubuntu-based VM.
Args:
vm: The VM instance where the OpenJDK should be installed.
| AptInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openjdk_msft.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openjdk_msft.py | Apache-2.0 |
def YumInstall(vm):
"""Installs Microsoft Build of OpenJDK on a RHEL/CentOS-based VM.
Args:
vm: The VM instance where the OpenJDK should be installed.
"""
vm.RemoteCommand('sudo yum install -y wget')
vm.RemoteCommand(
'sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc'
)
vm.... | Installs Microsoft Build of OpenJDK on a RHEL/CentOS-based VM.
Args:
vm: The VM instance where the OpenJDK should be installed.
| YumInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openjdk_msft.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openjdk_msft.py | Apache-2.0 |
def InstallNeoverseCompiledOpenJDK(vm, jdk_version: int):
"""Compiles and installs OpenJDK for Neoverse ARM on the VM.
Installation instructions inpired by
https://metebalci.com/blog/custom-openjdk-10-builds-on-ubuntu-16.04/
Args:
vm: VM to build OpenJDK on
jdk_version: an integer indicating the j... | Compiles and installs OpenJDK for Neoverse ARM on the VM.
Installation instructions inpired by
https://metebalci.com/blog/custom-openjdk-10-builds-on-ubuntu-16.04/
Args:
vm: VM to build OpenJDK on
jdk_version: an integer indicating the jdk version to build
| InstallNeoverseCompiledOpenJDK | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openjdk_neoverse.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openjdk_neoverse.py | Apache-2.0 |
def GetMpiVersion(vm):
"""Get the MPI version on the vm, based on mpirun.
Args:
vm: the virtual machine to query
Returns:
A string containing the active MPI version,
None if mpirun could not be found
Raises:
MpirunParseOutputError: if parsing fails.
"""
stdout, _ = vm.RemoteCommand('mpiru... | Get the MPI version on the vm, based on mpirun.
Args:
vm: the virtual machine to query
Returns:
A string containing the active MPI version,
None if mpirun could not be found
Raises:
MpirunParseOutputError: if parsing fails.
| GetMpiVersion | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openmpi.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openmpi.py | Apache-2.0 |
def _Install(vm):
"""Installs the OpenMPI package on the VM."""
version_to_install = FLAGS.openmpi_version
if not version_to_install:
return
current_version = GetMpiVersion(vm)
if current_version == version_to_install:
return
first_dot_pos = version_to_install.find('.')
second_dot_pos = version_t... | Installs the OpenMPI package on the VM. | _Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openmpi.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openmpi.py | Apache-2.0 |
def GetMpiDir():
"""Returns the installation directory of OpenMPI."""
mpi_dir = posixpath.join(
linux_packages.INSTALL_DIR,
'openmpi-{version}'.format(version=FLAGS.openmpi_version),
)
return mpi_dir | Returns the installation directory of OpenMPI. | GetMpiDir | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/openmpi.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/openmpi.py | Apache-2.0 |
def _CheckSupported(vm):
"""Check if the GPU type is supported."""
# TODO(yuyanting): Add support for other GPU types.
if nvidia_driver.GetGpuType(vm) not in (
nvidia_driver.NVIDIA_H100, nvidia_driver.NVIDIA_H200):
logging.warn('Skipping GPU optimization for non-H100, H200 GPU.')
return False
retu... | Check if the GPU type is supported. | _CheckSupported | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/optimize_gpu.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/optimize_gpu.py | Apache-2.0 |
def Install(vm):
"""Optimize GPU settings on the VM."""
if not _CheckSupported(vm):
return
# Following:
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/optimize_gpu.html
nvidia_driver.EnablePersistenceMode(vm)
if nvidia_driver.GetGpuType(vm) == nvidia_driver.NVIDIA_H100:
vm.RemoteCommand('sudo... | Optimize GPU settings on the VM. | Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/optimize_gpu.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/optimize_gpu.py | Apache-2.0 |
def SetContainerEnv(vm):
"""Set container environment to use optimized network stack.
For AWS p5, this method assumes EFA is installed inside the container
(rather than through mount).
For GCP a3-mega, tcpxo is installed following the guide and passed to the
container through mount.
Args:
vm: VirtualM... | Set container environment to use optimized network stack.
For AWS p5, this method assumes EFA is installed inside the container
(rather than through mount).
For GCP a3-mega, tcpxo is installed following the guide and passed to the
container through mount.
Args:
vm: VirtualMachine object.
Returns:
... | SetContainerEnv | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/optimize_gpu.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/optimize_gpu.py | Apache-2.0 |
def _BuildGCPTopoAwareHostFile(controller, nnodes):
"""Build topo aware hostfile.
https://cloud.google.com/cluster-toolkit/docs/machine-learning/a3-mega-enable-gpudirect-tcpxo#run_nccl_test
Args:
controller: The controller VM
nnodes: The number of nodes in the cluster
"""
controller.RemoteCommand(
... | Build topo aware hostfile.
https://cloud.google.com/cluster-toolkit/docs/machine-learning/a3-mega-enable-gpudirect-tcpxo#run_nccl_test
Args:
controller: The controller VM
nnodes: The number of nodes in the cluster
| _BuildGCPTopoAwareHostFile | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/optimize_gpu.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/optimize_gpu.py | Apache-2.0 |
def AptInstall(vm):
"""Installs the pgadapter package on the VM."""
# psmisc helps with restarting PGAdapter.
vm.InstallPackages('default-jre psmisc')
vm.RemoteCommand(f'wget {PGADAPTER_URL}')
vm.RemoteCommand('tar -xzvf pgadapter.tar.gz') | Installs the pgadapter package on the VM. | AptInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/pgadapter.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/pgadapter.py | Apache-2.0 |
def YumInstall(vm):
"""Raises exception when trying to install on yum-based VMs."""
raise NotImplementedError(
'PKB currently only supports the installation of pgbench on '
'Debian-based VMs'
) | Raises exception when trying to install on yum-based VMs. | YumInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/pgbench.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/pgbench.py | Apache-2.0 |
def AptUninstall(vm):
"""Removes pgbench from the Debian VM."""
remove_str = 'sudo apt-get --purge autoremove -y '
for package in APT_PACKAGES:
vm.RemoteCommand(remove_str + package) | Removes pgbench from the Debian VM. | AptUninstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/pgbench.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/pgbench.py | Apache-2.0 |
def MakeSamplesFromOutput(
pgbench_stderr, num_clients, num_jobs, additional_metadata
):
"""Creates sample objects from the given pgbench output and metadata.
Two samples will be returned, one containing a latency list and
the other a tps (transactions per second) list. Each will contain
N floating point s... | Creates sample objects from the given pgbench output and metadata.
Two samples will be returned, one containing a latency list and
the other a tps (transactions per second) list. Each will contain
N floating point samples, where N = FLAGS.pgbench_seconds_per_test.
Args:
pgbench_stderr: stderr from the pgb... | MakeSamplesFromOutput | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/pgbench.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/pgbench.py | Apache-2.0 |
def RunPgBench(
benchmark_spec,
relational_db,
vm,
test_db_name,
client_counts,
job_counts,
seconds_to_pause,
seconds_per_test,
protocol,
metadata,
file=None,
path=None,
):
"""Run Pgbench on the client VM.
Args:
benchmark_spec: Benchmark spec of the run
relat... | Run Pgbench on the client VM.
Args:
benchmark_spec: Benchmark spec of the run
relational_db: Relational database object
vm: Client VM
test_db_name: The name of the database
client_counts: Number of client
job_counts: Number of job
seconds_to_pause: Seconds to pause between test
second... | RunPgBench | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/pgbench.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/pgbench.py | Apache-2.0 |
def _DownloadAndInstallPip(vm):
"""Download and install pip using get-pip.py.
get-pip.py has the appropriate latest version of pip for all Python versions.
Prefer it over linux packages or easy_install.
Args:
vm: The VM to install pip on.
"""
logging.info('pip not bundled with Python. Installing with ... | Download and install pip using get-pip.py.
get-pip.py has the appropriate latest version of pip for all Python versions.
Prefer it over linux packages or easy_install.
Args:
vm: The VM to install pip on.
| _DownloadAndInstallPip | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/pip.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/pip.py | Apache-2.0 |
def AptInstall(vm):
"""Installs the postgres package on the VM."""
vm.RemoteCommand(
"sudo sh -c 'echo "
'"deb https://apt.postgresql.org/pub/repos/apt '
'$(lsb_release -cs)-pgdg main" '
"> /etc/apt/sources.list.d/pgdg.list'"
)
vm.InstallPackages('wget')
vm.RemoteCommand(
'wget -... | Installs the postgres package on the VM. | AptInstall | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/postgres13.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/postgres13.py | Apache-2.0 |
def ConfigureAndRestart(vm, run_uri, buffer_size, conf_template_path):
"""Configure and restart postgres.
Args:
vm: virtual machine to configure postgres on.
run_uri: run uri to use for password generation.
buffer_size: buffer size to use for postgres.
conf_template_path: path to the postgres conf ... | Configure and restart postgres.
Args:
vm: virtual machine to configure postgres on.
run_uri: run uri to use for password generation.
buffer_size: buffer size to use for postgres.
conf_template_path: path to the postgres conf template file.
| ConfigureAndRestart | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/postgresql16.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/postgresql16.py | Apache-2.0 |
def _Install(vm):
"""Installs the postgres client package on the VM."""
# Install Postgres client
vm.RemoteCommand(
'sudo sh -c '
'\'echo "deb https://apt.postgresql.org/pub/repos/apt'
' $(lsb_release -cs)-pgdg main" >'
" /etc/apt/sources.list.d/pgdg.list'"
)
vm.InstallPackages('wget')... | Installs the postgres client package on the VM. | _Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/postgres_client.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/postgres_client.py | Apache-2.0 |
def _Install(vm, dev_package: str):
"""Installs python rrdtool on the VM."""
vm.Install('pip')
vm.InstallPackages('rrdtool ' + dev_package)
vm.RemoteCommand('sudo pip3 install rrdtool') | Installs python rrdtool on the VM. | _Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/python_rrdtool.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/python_rrdtool.py | Apache-2.0 |
def _Install(vm):
"""Installs the pyyaml package on the VM."""
vm.Install('pip')
vm.RemoteCommand('sudo pip install pyyaml') | Installs the pyyaml package on the VM. | _Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/pyyaml.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/pyyaml.py | Apache-2.0 |
def _Install(vm) -> None:
"""Installs the redis package on the VM."""
vm.RemoteCommand(
'curl -fsSL https://packages.redis.io/gpg | sudo gpg --batch --yes'
' --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg'
)
vm.RemoteCommand(
'echo "deb [signed-by=/usr/share/keyrings/redis-archive-... | Installs the redis package on the VM. | _Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_cli.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_cli.py | Apache-2.0 |
def _GetTarName() -> str | None:
"""Returns the Redis Enterprise package to use depending on the os.
For information about available packages, see
https://redislabs.com/redis-enterprise/software/downloads/.
"""
if FLAGS.os_type in [os_types.RHEL, os_types.AMAZONLINUX2, os_types.CENTOS7]:
return _RHEL_TAR... | Returns the Redis Enterprise package to use depending on the os.
For information about available packages, see
https://redislabs.com/redis-enterprise/software/downloads/.
| _GetTarName | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def Install(vm: _VM) -> None:
"""Installs Redis Enterprise package on the VM."""
vm.InstallPackages('wget')
vm.RemoteCommand(f'mkdir -p {_WORKING_DIR}')
# Check for the license in the data directory if a path isn't specified.
license_path = _LICENSE_PATH.value
if not license_path:
license_path = data.R... | Installs Redis Enterprise package on the VM. | Install | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def CreateCluster(vms: List[_VM]) -> None:
"""Creates a Redis Enterprise cluster on the VM."""
logging.info('Creating redis enterprise cluster.')
vms[0].RemoteCommand(
'sudo /opt/redislabs/bin/rladmin cluster create '
'license_file {license_file} '
'name redis-cluster '
'username {username... | Creates a Redis Enterprise cluster on the VM. | CreateCluster | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def TuneProxy(vm: _VM, proxy_threads: int | None = None) -> None:
"""Tunes the number of Redis proxies on the cluster."""
proxy_threads = proxy_threads or _PROXY_THREADS.value
vm.RemoteCommand(
'sudo /opt/redislabs/bin/rladmin tune '
'proxy all '
f'max_threads {proxy_threads} '
f'threads {... | Tunes the number of Redis proxies on the cluster. | TuneProxy | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def PinWorkers(vms: List[_VM], proxy_threads: int | None = None) -> None:
"""Splits the Redis worker threads across the NUMA nodes evenly.
This function is no-op if --enterprise_redis_pin_workers is not set.
Args:
vms: The VMs with the Redis workers to pin.
proxy_threads: The number of proxy threads per... | Splits the Redis worker threads across the NUMA nodes evenly.
This function is no-op if --enterprise_redis_pin_workers is not set.
Args:
vms: The VMs with the Redis workers to pin.
proxy_threads: The number of proxy threads per VM.
| PinWorkers | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def GetDatabaseMemorySize(vm: _VM) -> int:
"""Gets the available memory (bytes) that can be used to provision databases."""
output, _ = vm.RemoteCommand('sudo /opt/redislabs/bin/rladmin status')
# See tests/data/redis_enterprise_cluster_output.txt
node_output = output.splitlines()[2]
provisional_ram = node_ou... | Gets the available memory (bytes) that can be used to provision databases. | GetDatabaseMemorySize | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def _BuildLoadCommand(request: LoadRequest) -> str:
"""Returns the command used to load the database."""
command = (
'sudo /opt/redislabs/bin/memtier_benchmark '
f'-s {request.server_ip} '
f'-a {FLAGS.run_uri} '
f'-p {str(request.redis_port)} '
'-t 1 ' # Set -t and -c to 1 to avoid du... | Returns the command used to load the database. | _BuildLoadCommand | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def LoadDatabases(
redis_vms: List[_VM],
load_vms: List[_VM],
endpoints: List[Tuple[str, int]],
shards: int | None = None,
) -> None:
"""Loads the databases before performing tests."""
vms = load_vms + redis_vms
load_requests = []
load_records_per_vm = _LOAD_RECORDS.value // len(vms)
shards = ... | Loads the databases before performing tests. | LoadDatabases | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def _LogCurlifiedCommand(self, response: requests.Response) -> None:
"""Logs the version of the request that can be run from curl."""
request = response.request
command = f'curl -v -k -u {_USERNAME}:{FLAGS.run_uri} -X {request.method} '
if request.body:
body = request.body.decode('UTF-8')
co... | Logs the version of the request that can be run from curl. | _LogCurlifiedCommand | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def GetDatabases(self) -> _UidToJsonDict | None:
"""Gets the database object(s) running in the cluster.
Returns:
A dictionary of database objects by uid, per
https://docs.redis.com/latest/rs/references/rest-api/objects/bdb/.
Raises:
errors.Benchmarks.RunError: If the number of databases ... | Gets the database object(s) running in the cluster.
Returns:
A dictionary of database objects by uid, per
https://docs.redis.com/latest/rs/references/rest-api/objects/bdb/.
Raises:
errors.Benchmarks.RunError: If the number of databases found does not
match --enterprise_redis_db_count... | GetDatabases | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def GetEndpoints(self) -> List[Tuple[str, int]]:
"""Returns a list of (ip, port) tuples."""
endpoints = []
for db in self.GetDatabases().values():
host = db['endpoints'][0]['addr'][0]
port = db['endpoints'][0]['port']
endpoints.append((host, port))
logging.info('Database endpoints: %s'... | Returns a list of (ip, port) tuples. | GetEndpoints | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def GetDatabase(self, uid: int) -> _Json | None:
"""Returns the database JSON object corresponding to uid."""
logging.info('Getting Redis Enterprise database (uid: %s).', uid)
all_databases = self.GetDatabases()
return all_databases.get(uid, None) | Returns the database JSON object corresponding to uid. | GetDatabase | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def WaitForDatabaseUp(self, uid: int) -> None:
"""Waits for the Redis Enterprise database to become active."""
db = self.GetDatabase(uid)
if not db:
raise errors.Benchmarks.RunError(
'Database %s does not exist, expected to be waiting for startup.'
)
if db['status'] != 'active':
... | Waits for the Redis Enterprise database to become active. | WaitForDatabaseUp | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def CreateDatabase(self, shards: int | None = None) -> _Json:
"""Creates a new Redis Enterprise database.
See https://docs.redis.com/latest/rs/references/rest-api/objects/bdb/.
Args:
shards: Number of shards for the database. In a clustered setup, shards
will be distributed evenly across nod... | Creates a new Redis Enterprise database.
See https://docs.redis.com/latest/rs/references/rest-api/objects/bdb/.
Args:
shards: Number of shards for the database. In a clustered setup, shards
will be distributed evenly across nodes.
Returns:
Returns the JSON object corresponding to the ... | CreateDatabase | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def DeleteDatabase(self, uid: int) -> None:
"""Deletes the database from the cluster."""
logging.info('Deleting Redis Enterprise database (uid: %s).', uid)
r = self.session.delete(f'{self.api_base_url}/v1/bdbs/{uid}', verify=False)
self._LogCurlifiedCommand(r)
if self.GetDatabase(uid) is not None:
... | Deletes the database from the cluster. | DeleteDatabase | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def _BuildRunCommand(
host: str, threads: int, port: int, shards: int | None = None
) -> str:
"""Spawns a memtier_benchmark on the load_vm against the redis_vm:port.
Args:
host: The target IP of the memtier_benchmark
threads: The number of threads to run in this memtier_benchmark process.
port: The... | Spawns a memtier_benchmark on the load_vm against the redis_vm:port.
Args:
host: The target IP of the memtier_benchmark
threads: The number of threads to run in this memtier_benchmark process.
port: The port to target on the redis_vm.
shards: The number of shards per database.
Returns:
Command... | _BuildRunCommand | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def ToSample(self, metadata: Dict[str, Any]) -> sample.Sample:
"""Returns throughput sample attached with the given metadata."""
self.metadata.update(metadata)
return sample.Sample('throughput', self.throughput, 'ops/s', self.metadata) | Returns throughput sample attached with the given metadata. | ToSample | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def ParseResults(output: str) -> List[Result]:
"""Parses the result from the cluster statistics API."""
output_json = json.loads(output)
results = []
for interval in output_json.get('intervals'):
results.append(
Result(interval.get('total_req'), interval.get('avg_latency'), interval)
)
return ... | Parses the result from the cluster statistics API. | ParseResults | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def Run(
redis_vms: List[_VM],
load_vms: List[_VM],
shards: int | None = None,
proxy_threads: int | None = None,
memtier_threads: int | None = None,
) -> _ThroughputSampleTuple:
"""Run memtier against enterprise redis and measure latency and throughput.
This function runs memtier against the re... | Run memtier against enterprise redis and measure latency and throughput.
This function runs memtier against the redis server vm with increasing memtier
threads until one of following conditions is reached:
- FLAGS.enterprise_redis_max_threads is reached
- FLAGS.enterprise_redis_latency_threshold is reached... | Run | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def GetMetadata(
shards: int, threads: int, proxy_threads: int
) -> Dict[str, Any]:
"""Returns metadata associated with the run.
Args:
shards: The shard count per database.
threads: The thread count used by the memtier client.
proxy_threads: The proxy thread count used on the redis cluster.
Retu... | Returns metadata associated with the run.
Args:
shards: The shard count per database.
threads: The thread count used by the memtier client.
proxy_threads: The proxy thread count used on the redis cluster.
Returns:
A dictionary of metadata that can be attached to the run sample.
| GetMetadata | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def _CreateAndLoadDatabases(self, shards: int) -> None:
"""Creates and loads all the databases needed for the run."""
self.client.CreateDatabases(shards)
LoadDatabases(
self.server_vms, self.client_vms, self.client.GetEndpoints(), shards
) | Creates and loads all the databases needed for the run. | _CreateAndLoadDatabases | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def _FullRun(
self, shard_count: int, proxy_thread_count: int
) -> _ThroughputSampleTuple:
"""Recreates databases if needed, then runs the test."""
logging.info(
'Starting new run with %s shards, %s proxy threads',
shard_count,
proxy_thread_count,
)
server_vm = self.serve... | Recreates databases if needed, then runs the test. | _FullRun | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def _GetNeighborsToCheck(
self, shards: int, proxy_threads: int
) -> List[Tuple[int, int]]:
"""Returns the shards/proxy_threads neighbor to check."""
vary_proxy_threads = [
(shards, proxy_threads - 1),
(shards, proxy_threads + 1),
]
vary_shards = [(shards - 1, proxy_threads), (sh... | Returns the shards/proxy_threads neighbor to check. | _GetNeighborsToCheck | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def _GetOptimalNeighbor(
self, shards: int, proxy_threads: int
) -> Tuple[int, int]:
"""Returns the shards/proxy_threads neighbor with the best throughput."""
optimal_shards = shards
optimal_proxy_threads = proxy_threads
optimal_throughput, _ = self._GetResult(shards, proxy_threads)
for sha... | Returns the shards/proxy_threads neighbor with the best throughput. | _GetOptimalNeighbor | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def DoGraphSearch(self) -> _ThroughputSampleTuple:
"""Performs a graph search with the optimal shards AND proxy thread count.
Performs a graph search through shards and proxy threads. If the current
combination is a local maximum, finish and return the result.
The DB needs to be recreated since shards... | Performs a graph search with the optimal shards AND proxy thread count.
Performs a graph search through shards and proxy threads. If the current
combination is a local maximum, finish and return the result.
The DB needs to be recreated since shards can only be resized in multiples
once created.
R... | DoGraphSearch | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def DoLinearSearch(self) -> _ThroughputSampleTuple:
"""Performs a linear search using either shards or proxy threads."""
logging.info('Performing linear search through proxy threads OR shards.')
max_throughput_tuple = (0, None)
num_cpus = self.server_vms[0].num_cpus
for i in range(1, num_cpus):
... | Performs a linear search using either shards or proxy threads. | DoLinearSearch | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def GetOptimalThroughput(self) -> _ThroughputSampleTuple:
"""Gets the optimal throughput for the Redis Enterprise cluster.
Returns:
Tuple of (optimal_throughput, samples).
"""
# If only optimizing proxy threads, do a linear search.
if (_SHARDS.value and not _PROXY_THREADS.value) or (
... | Gets the optimal throughput for the Redis Enterprise cluster.
Returns:
Tuple of (optimal_throughput, samples).
| GetOptimalThroughput | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_enterprise.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_enterprise.py | Apache-2.0 |
def CheckPrerequisites():
"""Verifies if the flags are valid."""
values = IO_THREADS.value
try:
int_values = [int(v) for v in values] if values is not None else []
except ValueError as e:
raise errors.Setup.InvalidFlagConfigurationError(
'redis_server_io_threads must be a list of valid integers... | Verifies if the flags are valid. | CheckPrerequisites | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_server.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_server.py | Apache-2.0 |
def _BuildStartCommand(vm, port: int) -> str:
"""Returns the run command used to start the redis server.
See https://raw.githubusercontent.com/redis/redis/6.0/redis.conf
for the default redis configuration.
Args:
vm: The redis server VM.
port: The port to start redis on.
Returns:
A command that... | Returns the run command used to start the redis server.
See https://raw.githubusercontent.com/redis/redis/6.0/redis.conf
for the default redis configuration.
Args:
vm: The redis server VM.
port: The port to start redis on.
Returns:
A command that can be used to start redis in the background.
| _BuildStartCommand | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_server.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_server.py | Apache-2.0 |
def Stop(vm) -> None:
"""Stops redis server processes, flushes all keys, and resets the cluster."""
redis_dir = GetRedisDir()
ports = GetRedisPorts(vm)
for port in ports:
vm.TryRemoteCommand(f'sudo {redis_dir}/src/redis-cli -p {port} flushall')
for port in ports:
vm.TryRemoteCommand(
f'sudo ... | Stops redis server processes, flushes all keys, and resets the cluster. | Stop | python | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/redis_server.py | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/redis_server.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.