code: def generate_singa_config(with_cuda, with_nccl):
      """Generate singa_config.h file to define some macros for the cpp code.
  
      Args:
          with_cuda(bool): indicator for cudnn and cuda lib
          with_nccl(bool): indicator for nccl lib
      """
      config = [
          "#define USE_CBLAS",
          "#define USE_GLOG",
          "#define USE_DNNL",
      ]
      if not with_cuda:
          config.append("#define CPU_ONLY")
      else:
          config.append("#define USE_CUDA")
          config.append("#define USE_CUDNN")
  
      if with_nccl:
          config.append("#define ENABLE_DIST")
          config.append("#define USE_DIST")
  
      # singa_config.h to be included by cpp code
      cpp_conf_path = SINGA_HDR / "singa/singa_config.h"
      print("Writing configs to {}".format(cpp_conf_path))
      with cpp_conf_path.open("w") as fd:
          for line in config:
              fd.write(line + "\n")
          versions = [
              int(x) for x in VERSION.split("+")[0].split(".")[:3]
          ]
          fd.write(
              "#define SINGA_MAJOR_VERSION {}\n".format(versions[0])
          )
          fd.write(
              "#define SINGA_MINOR_VERSION {}\n".format(versions[1])
          )
          fd.write(
              "#define SINGA_PATCH_VERSION {}\n".format(versions[2])
          )
          fd.write('#define SINGA_VERSION "{}"\n'.format(VERSION))
  
      # config.i to be included by swig files
      swig_conf_path = SINGA_SRC / "api/config.i"
      with swig_conf_path.open("w") as fd:
          for line in config:
              fd.write(line + " 1 \n")
  
          fd.write("#define USE_PYTHON 1\n")
          if not with_nccl:
              fd.write("#define USE_DIST 0\n")
          if not with_cuda:
              fd.write("#define USE_CUDA 0\n")
              fd.write("#define USE_CUDNN 0\n")
          else:
              fd.write(
                  '#define CUDNN_VERSION "{}"\n'.format(
                      os.environ.get("CUDNN_VERSION")
                  )
              )
          versions = [
              int(x) for x in VERSION.split("+")[0].split(".")[:3]
          ]
          fd.write(
              "#define SINGA_MAJOR_VERSION {}\n".format(versions[0])
          )
          fd.write(
              "#define SINGA_MINOR_VERSION {}\n".format(versions[1])
          )
          fd.write(
              "#define SINGA_PATCH_VERSION {}\n".format(versions[2])
          )
          fd.write('#define SINGA_VERSION "{}"\n'.format(VERSION))
  
imports: from setuptools import find_packages, setup, Command, Extension
  from setuptools.command.build_ext import build_ext
  from distutils.errors import CompileError, DistutilsSetupError
  import os
  import io
  import sys
  import subprocess
  import shutil
  import shlex
  from pathlib import Path
  import numpy
  from datetime import date
label_desc: Use image node_id 2 for calling a global function with example usage: generate_singa_config(with_cuda, with_nccl) without return types