Argobots Threading and Tasking Framework

repository·main·Indexed 41 days ago

https://github.com/pmodels/argobots

A lightweight, low-level threading and tasking framework designed for high-performance computing environments. It provides tools for managing Execution Stream (ES) affinity, scheduler settings, and memory allocation, with configurable optimization levels and debugging options.

Tokens
1.9K
Snippets
3
Records
9
Agent score
50%

What's inside Argobots

  1. Install Argobots from source

    main

    To install Argobots, follow these steps in order. Ensure you have a C compiler (like gcc) installed. You should also identify your shell (e.g., bash, csh, or tcsh) using echo $SHELL to use the correct command syntax for redirection.

    1. Preparation

    If using a release tarball:

    tar xzf argobots.tar.gz
    cd argobots

    Note: If your tar does not support the -z option, use:

    gunzip argobots.tar.gz
    tar xf argobots.tar
    cd argobots

    If using a GitHub clone:

    cd argobots
    ./autogen.sh

    2. Configure

    Choose a non-existent or empty installation directory. Use the --prefix flag to specify it.

    For bash/standard shells:

    ./configure --prefix=/home/USERNAME/argobots-install 2>&1 | tee c.txt

    For csh or tcsh:

    ./configure --prefix=/home/USERNAME/argobots-install |& tee c.txt

    3. Build

    make 2>&1 | tee m.txt

    For csh or tcsh:

    make |& tee m.txt

    If the build fails, try cleaning and running with verbose output:

    make clean
    make V=1 2>&1 | tee m.txt

    4. Install

    This step copies the required files into the bin subdirectory of your chosen prefix.

    For bash/standard shells:

    make install 2>&1 | tee mi.txt

    For csh or tcsh:

    make install |& tee mi.txt
    ./configure --prefix=/home/USERNAME/argobots-install 2>&1 | tee c.txt
    make 2>&1 | tee m.txt
    make install 2>&1 | tee mi.txt
  2. Configure Argobots compiler optimizations and flags

    main

    Argobots uses CFLAGS for optimizations. By default, it uses -O2. You can customize the build via ./configure options.

    Optimization Levels

    Use --enable-fast to change the optimization level. For example, to use -O3:

    ./configure --enable-fast=O3

    For Performance Testing:

    ./configure --enable-perf-opt --enable-affinity --disable-checks

    For Debugging:

    ./configure --enable-fast=O0 --enable-debug=most

    To see all available configuration options, run:

    ./configure --help
  3. Troubleshoot and report Argobots problems

    main

    If you encounter issues, follow these steps:

    1. Check the FAQ: Visit the Argobots Wiki FAQ.
    2. Search Mailing Lists: Check the discuss@argobots.org archive.
    3. Email the Developers: If the above fail, email discuss@argobots.org. You must subscribe to the list first. Important: When emailing, compress and attach the following files generated during your build process:
      • argobots/c.txt (from configure)
      • argobots/m.txt (from make)
      • argobots/mi.txt (from make install)
      • argobots/config.log (from configure) Include the specific error message and a minimal reproduction case if possible.
    4. GitHub Issues: For confirmed bugs, report them at github.com/pmodels/argobots/issues. It is recommended to email the mailing list first.
  4. Configure Logging and Debugging

    main

    To enable logging and debug messages, Argobots must be configured with the --enable-debug flag. The behavior of these variables depends on how --enable-debug was set:

    • ABT_USE_LOG (or ABT_ENV_USE_LOG): Enables logging.
      • Values: 1, Y, 0, N
      • Default: 1 if configured with --enable-debug=log or --enable-debug=all; 0 if configured with --enable-debug=most
    • ABT_USE_DEBUG (or ABT_ENV_USE_DEBUG): Enables debug messages.
      • Values: 1, Y, 0, N
      • Default: 1 if configured with --enable-debug=log or --enable-debug=all; 0 if configured with --enable-debug=most
    • ABT_USE_EVENT_DEBUG (or ABT_ENV_USE_EVENT_DEBUG): Enables debug messages for events. This is effective when configured with --enable-power-event or --enable-publish-info.
      • Values: 1, Y, 0, N
      • Default: 1 if configured with --enable-debug=log or --enable-debug=all; 0 if configured with --enable-debug=most
    • ABT_PRINT_CONFIG (or ABT_ENV_PRINT_CONFIG): Determines if the configuration is printed during ABT_init().
      • Values: 1, Y, 0, N
      • Default: 0
  5. Configure Memory and Page sizes

    main

    Control memory allocation, page sizes, and cache alignment:

    • ABT_CACHE_LINE_SIZE (or ABT_ENV_CACHE_LINE_SIZE): Cache line size. (Unsigned integer, Default: 64)
    • ABT_OS_PAGE_SIZE (or ABT_ENV_OS_PAGE_SIZE): OS page size. (Unsigned integer, Default: 4096)
    • ABT_HUGE_PAGE_SIZE (or ABT_ENV_HUGE_PAGE_SIZE): Huge page size. (Unsigned integer, Default: 2097152)
    • ABT_MEM_PAGE_SIZE (or ABT_ENV_MEM_PAGE_SIZE): Page size for memory allocation. (Unsigned integer, Default: 2097152)
    • ABT_MEM_STACK_PAGE_SIZE (or ABT_ENV_MEM_STACK_PAGE_SIZE): Stack page size for memory allocation. (size_t, Default: 8388608)
    • ABT_MEM_MAX_NUM_STACKS (or ABT_ENV_MEM_MAX_NUM_STACKS): Max stacks each ES can keep during execution. (Unsigned integer, Default: 65536)
    • ABT_MEM_LP_ALLOC (or ABT_ENV_MEM_LP_ALLOC): Method for allocating large pages.
      • Values: malloc, mmap_rp, mmap_hp_rp, mmap_hp_thp, thp
      • Default: mmap_hp_rp if anonymous page is supported, otherwise malloc
  6. Configure Event Handling and Information Publishing

    main

    Manage power management daemons and execution information publishing:

    • ABT_POWER_EVENT_HOSTNAME (or ABT_ENV_POWER_EVENT_HOSTNAME): Hostname for the power management daemon. (string, Default: localhost)
    • ABT_POWER_EVENT_PORT (or ABT_ENV_POWER_EVENT_PORT): Port number for the power management daemon. (integer, Default: 60439)
    • ABT_PUBLISH_INFO (or ABT_ENV_PUBLISH_INFO): Whether to publish execution information. (Values: 1, Y, 0, N; Default: 1)
    • ABT_PUBLISH_FILENAME (or ABT_ENV_PUBLISH_FILENAME): Filename for publishing execution information. (string; Default: beacon if BEACON is used, stdout otherwise)
    • ABT_PUBLISH_INTERVAL (or ABT_ENV_PUBLISH_INTERVAL): Time interval for publishing execution information. (float, Default: 1.0)
  7. Configure ES Affinity via environment variables

    main

    Argobots allows you to control Execution Stream (ES) affinity to bind ESs to specific CPU cores. This requires the system to be configured with the --enable-affinity flag during build/setup.

    Use the following environment variables:

    • ABT_SET_AFFINITY (or ABT_ENV_SET_AFFINITY): Enables ES affinity.
      • Values: 1, Y, 0, N
      • Default: 1
    • ABT_AFFINITY_TYPE (or ABT_ENV_AFFINITY_TYPE): Determines the binding method.
      • Values: default, chameleon, knc
      • Default: default
  8. Configure Execution and Scheduler settings

    main

    Adjust the runtime behavior of execution streams and the scheduler using these variables:

    • ABT_MAX_NUM_XSTREAMS (or ABT_ENV_MAX_NUM_XSTREAMS): Maximum number of ESs that can be created. (Unsigned integer, Default: # of hardware threads)
    • ABT_KEY_TABLE_SIZE (or ABT_ENV_KEY_TABLE_SIZE): Default number of key table entries. (Unsigned integer, Default: 4)
    • ABT_THREAD_STACKSIZE (or ABT_ENV_THREAD_STACKSIZE): Default stack size for User-Level Threads (ULT). (size_t, Default: 16384)
    • ABT_SCHED_STACKSIZE (or ABT_ENV_SCHED_STACKSIZE): Default stack size for the scheduler. (size_t, Default: 4194394)
    • ABT_SCHED_EVENT_FREQ (or ABT_ENV_SCHED_EVENT_FREQ): Default event checking frequency for the scheduler. (Unsigned integer, Default: 50)
    • ABT_SCHED_SLEEP_NSEC (or ABT_ENV_SCHED_SLEEP_NSEC): Default nanosleep value for scheduler sleep. (long, Default: 100)
    • ABT_MUTEX_MAX_HANDOVERS (or ABT_ENV_MUTEX_MAX_HANDOVERS): Max mutex handovers within an ES before giving up the mutex. (Unsigned integer, Default: 64)
    • ABT_MUTEX_MAX_WAKEUPS (or ABT_ENV_MUTEX_MAX_WAKEUPS): Max ULTs to wake up at once in ABT_mutex_unlock() or ABT_mutex_unlock_de(). (Unsigned integer, Default: 1)