code: def main():
      import sys
  
      from aksetup_helper import (
          hack_distutils,
          get_config,
          setup,
          ExtensionUsingNumpy,
          set_up_shipped_boost_if_requested,
          check_git_submodules,
          NumpyBuildExtCommand,
      )
  
      check_git_submodules()
  
      hack_distutils()
      conf = get_config(get_config_schema())
  
      EXTRA_SOURCES, EXTRA_DEFINES = set_up_shipped_boost_if_requested(
          "pycuda", conf
      )
  
      EXTRA_DEFINES["PYGPU_PACKAGE"] = "pycuda"
      EXTRA_DEFINES["PYGPU_PYCUDA"] = "1"
  
      LIBRARY_DIRS = conf["BOOST_LIB_DIR"] + conf["CUDADRV_LIB_DIR"]
      LIBRARIES = (
          conf["BOOST_PYTHON_LIBNAME"]
          + conf["BOOST_THREAD_LIBNAME"]
          + conf["CUDADRV_LIBNAME"]
      )
  
      if not conf["CUDA_INC_DIR"] and conf["CUDA_ROOT"]:
          conf["CUDA_INC_DIR"] = [join(conf["CUDA_ROOT"], "include")]
  
      if conf["CUDA_TRACE"]:
          EXTRA_DEFINES["CUDAPP_TRACE_CUDA"] = 1
  
      if conf["CUDA_PRETEND_VERSION"]:
          EXTRA_DEFINES["CUDAPP_PRETEND_CUDA_VERSION"] = conf[
              "CUDA_PRETEND_VERSION"
          ]
  
      INCLUDE_DIRS = ["src/cpp"] + conf["BOOST_INC_DIR"]
      if conf["CUDA_INC_DIR"]:
          INCLUDE_DIRS += conf["CUDA_INC_DIR"]
  
      conf["USE_CUDA"] = True
  
      if "darwin" in sys.platform and sys.maxsize == 2147483647:
          # The Python interpreter is running in 32 bit mode on OS X
          if "-arch" not in conf["CXXFLAGS"]:
              conf["CXXFLAGS"].extend(["-arch", "i386", "-m32"])
          if "-arch" not in conf["LDFLAGS"]:
              conf["LDFLAGS"].extend(["-arch", "i386", "-m32"])
  
      if "darwin" in sys.platform:
          # set path to Cuda dynamic libraries,
          # as a safe substitute for DYLD_LIBRARY_PATH
          for lib_dir in conf["CUDADRV_LIB_DIR"]:
              conf["LDFLAGS"].extend(
                  ["-Xlinker", "-rpath", "-Xlinker", lib_dir]
              )
  
      if conf["CUDA_ENABLE_GL"]:
          EXTRA_SOURCES.append("src/wrapper/wrap_cudagl.cpp")
          EXTRA_DEFINES["HAVE_GL"] = 1
  
      if conf["CUDA_ENABLE_CURAND"]:
          EXTRA_DEFINES["HAVE_CURAND"] = 1
          EXTRA_SOURCES.extend(["src/wrapper/wrap_curand.cpp"])
          LIBRARIES.extend(conf["CURAND_LIBNAME"])
          LIBRARY_DIRS.extend(conf["CURAND_LIB_DIR"])
  
      ver_dic = {}
      exec(
          compile(
              open("pycuda/__init__.py").read(),
              "pycuda/__init__.py",
              "exec",
          ),
          ver_dic,
      )
  
      import sys
  
      setup(
          name="pycuda",
          # metadata
          version=ver_dic["VERSION_TEXT"],
          description="Python wrapper for Nvidia CUDA",
          long_description=open("README.rst", "rt").read(),
          author="Andreas Kloeckner",
          author_email="inform@tiker.net",
          license="MIT",
          url="http://mathema.tician.de/software/pycuda",
          project_urls={
              "Source": "https://github.com/inducer/pycuda",
          },
          classifiers=[
              "Environment :: Console",
              "Development Status :: 5 - Production/Stable",
              "Intended Audience :: Developers",
              "Intended Audience :: Other Audience",
              "Intended Audience :: Science/Research",
              "License :: OSI Approved :: MIT License",
              "Natural Language :: English",
              "Programming Language :: C++",
              "Programming Language :: Python",
              "Programming Language :: Python :: 3",
              "Topic :: Scientific/Engineering",
              "Topic :: Scientific/Engineering :: Mathematics",
              "Topic :: Scientific/Engineering :: Physics",
              "Topic :: Scientific/Engineering :: Visualization",
          ],
          # build info
          packages=[
              "pycuda",
              "pycuda.gl",
              "pycuda.sparse",
              "pycuda.compyte",
          ],
          python_requires="~=3.8",
          install_requires=[
              "pytools>=2011.2",
              "appdirs>=1.4.0",
              "mako",
          ],
          test_requires=[
              "pytest>=2",
          ],
          ext_package="pycuda",
          ext_modules=[
              ExtensionUsingNumpy(
                  "_driver",
                  [
                      "src/cpp/cuda.cpp",
                      "src/cpp/bitlog.cpp",
                      "src/wrapper/wrap_cudadrv.cpp",
                      "src/wrapper/mempool.cpp",
                  ]
                  + EXTRA_SOURCES,
                  include_dirs=INCLUDE_DIRS,
                  library_dirs=LIBRARY_DIRS,
                  libraries=LIBRARIES,
                  define_macros=list(EXTRA_DEFINES.items()),
                  extra_compile_args=conf["CXXFLAGS"],
                  extra_link_args=conf["LDFLAGS"],
              ),
              ExtensionUsingNumpy(
                  "_pvt_struct",
                  ["src/wrapper/_pvt_struct_v3.cpp"],
                  extra_compile_args=conf["CXXFLAGS"],
                  extra_link_args=conf["LDFLAGS"],
              ),
          ],
          cmdclass={"build_ext": NumpyBuildExtCommand},
          include_package_data=True,
          package_data={
              "pycuda": [
                  "cuda/*.hpp",
              ]
          },
          zip_safe=False,
      )
  
imports: from __future__ import absolute_import, print_function
  from os.path import dirname, join, normpath
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types