code: def generate_test_matrix(
      num_cpus_in_cluster: int,
      num_gpus_in_cluster: int,
      num_tasks_or_actors_per_run: int,
      num_measurements_per_test: int,
  ):
      num_repeated_jobs_or_runs = num_measurements_per_test
      total_num_tasks_or_actors = (
          num_tasks_or_actors_per_run * num_repeated_jobs_or_runs
      )
  
      num_jobs_per_type = {
          "cold_start": num_repeated_jobs_or_runs,
          "warm_start": 1,
      }
  
      imports_to_try = ["torch", "none"]
  
      tests = set()
  
      for with_tasks in [True, False]:
          for with_gpu in [True, False]:
              # Do not run without runtime env. TODO(cade) Infra team added cgroups to
              # default runtime env, need to find some way around that if we want
              # "pure" (non-runtime-env) measurements.
              for with_runtime_env in [True]:
                  for import_to_try in imports_to_try:
                      for num_jobs in num_jobs_per_type.values():
                          num_tasks_or_actors_per_job = (
                              total_num_tasks_or_actors // num_jobs
                          )
                          num_runs_per_job = (
                              num_tasks_or_actors_per_job
                              // num_tasks_or_actors_per_run
                          )
  
                          test = TestConfiguration(
                              num_jobs=num_jobs,
                              num_runs_per_job=num_runs_per_job,
                              num_tasks_or_actors_per_run=num_tasks_or_actors_per_run,
                              with_tasks=with_tasks,
                              with_gpu=with_gpu,
                              with_runtime_env=with_runtime_env,
                              import_to_try=import_to_try,
                              num_cpus_in_cluster=num_cpus_in_cluster,
                              num_gpus_in_cluster=num_gpus_in_cluster,
                              num_nodes_in_cluster=1,
                          )
                          tests.add(test)
  
      return tests
  
imports: from collections import defaultdict
  from dataclasses import dataclass
  from ray._private.test_utils import safe_write_to_results_json
  from ray.job_submission import JobSubmissionClient, JobStatus
  import argparse
  import asyncio
  import random
  import ray
  import statistics
  import subprocess
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: generate_test_matrix(num_cpus_in_cluster, num_gpus_in_cluster, num_tasks_or_actors_per_run, num_measurements_per_test) and returns: tests