{"id":22668580,"url":"https://github.com/lanl/sicm","last_synced_at":"2025-06-17T22:07:42.734Z","repository":{"id":15442075,"uuid":"72141027","full_name":"lanl/SICM","owner":"lanl","description":"Simplified Interface to Complex Memory","archived":false,"fork":false,"pushed_at":"2023-08-31T21:04:30.000Z","size":15872,"stargazers_count":28,"open_issues_count":7,"forks_count":11,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-19T16:26:56.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lanl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-10-27T19:27:15.000Z","updated_at":"2025-03-28T14:22:58.000Z","dependencies_parsed_at":"2022-07-22T15:48:17.792Z","dependency_job_id":null,"html_url":"https://github.com/lanl/SICM","commit_stats":{"total_commits":318,"total_committers":19,"mean_commits":"16.736842105263158","dds":0.6383647798742138,"last_synced_commit":"b38e5767da47b328088da9d8ff25ec779e49d620"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lanl/SICM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanl%2FSICM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanl%2FSICM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanl%2FSICM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanl%2FSICM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lanl","download_url":"https://codeload.github.com/lanl/SICM/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanl%2FSICM/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260447686,"owners_count":23010548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T15:15:50.813Z","updated_at":"2025-06-17T22:07:37.722Z","avatar_url":"https://github.com/lanl.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SICM\nSimplified Interface to Complex Memory\n\n[![GitHub Actions](https://github.com/lanl/SICM/actions/workflows/sicm.yml/badge.svg)](https://github.com/lanl/SICM/actions)\n\n## Introduction\nThis project is split into two interfaces: `low` and `high`.\n\nThe `low` interface provides a minimal interface for application wanting to\nmanage their own memory on heterogeneous memory tiers. It also provides an\narena allocator that application developers can use to create `jemalloc` arenas\non different memory tiers and allocate to those tiers.\n\nThe `high` interface attempts to automatically manage the memory tiers for the\napplication. It provides an LLVM compiler pass (and compiler wrappers) to\nautomatically transform applications to make the appropriate `high` interface\ncalls, as well as a runtime library which provides profiling for the\napplication.  The profiling is currently meant to be used offline; that is,\nafter enabling the profiling for an application run, the results are printed\nout at the end of the run, and that information must be fed into a second run\nto make use of it. An online approach is planned.\n\n## Dependencies\n\nThe only dependencies that you will need for the low-level interface\nare `libnuma` and `jemalloc`. We require that `jemalloc` be\nconfigured with the `je_` prefix (using the `--with-jemalloc-prefix` flag).\n`CMake` will use `pkg-config` to find `jemalloc`.\n\nFor the high-level interface, you need an installation of LLVM. LLVM 4.0 and\nlater have been tested, although 3.9 may possibly work. For the profiling, you\nwill also need an installation of `libpfm`, which is a small helper library for\n`perf` that is available on most distributions.\n\nAdditionally, several other packages are required, and can be installed through a package manager:\n\n### Binaries\n- A modern C compiler\n- A modern C++ compiler\n- A modern Fortran compiler\n- CMake 3.0+\n- Make\n- numactl\n- automake + friends (if jemalloc needs to be built)\n\n### Development Libraries\nThese packages are usually named `lib*-dev` or `lib*-devel`:\n\n- numa\n\nAdditional packages are required for the high level interface:\n- hwloc\n- llvm\n- omp (if OpenMP is not available by default on your compilers)\n- pfm4\n\n## Compilation\n```\nexport PKG_CONFIG_PATH=\u003cjemalloc prefix\u003e/lib/pkgconfig:$PKG_CONFIG_PATH\nmkdir build\ncd build\ncmake .. -DCMAKE_INSTALL_PREFIX=\u003cprefix\u003e\nmake\nmake install\n```\n\n## Low-Level API\n| Function Name | Description |\n|---------------|-------------|\n| `sicm_init`  | Detects all memory devices on system, returns a list of them. |\n| `sicm_fini`  | Frees up a device list and associated SICM data structures. |\n| `sicm_find_device` | Return the first device that matches a given type and page size. |\n| `sicm_device_alloc` | Allocates to a given device. |\n| `sicm_device_free` | Frees memory on a device. |\n| `sicm_can_place_exact` | Returns whether or not a device supports exact placement. |\n| `sicm_device_alloc_exact` | Allocate memory on a device with an exact base address. |\n| `sicm_numa_id` | Returns the NUMA ID that a device is on. |\n| `sicm_device_page_size` | Returns the page size of a given device. |\n| `sicm_device_eq` | Returns if two devices are equal or not. |\n| `sicm_move`| Moves memory from one device to another. |\n| `sicm_pin` | Pin the current process to a device's memory. |\n| `sicm_capacity` | Returns the capacity of a given device. |\n| `sicm_avail` | Returns the amount of memory available on a given device. |\n| `sicm_model_distance` | Returns the distance of a given memory device. |\n| `sicm_is_near` | Returns whether or not a given memory device is nearby the current NUMA node. |\n| `sicm_latency` | Measures the latency of a memory device. |\n| `sicm_bandwidth_linear2` | Measures a memory device's linear access bandwidth. |\n| `sicm_bandwidth_random2` | Measures random access bandwidth of a memory device. |\n| `sicm_bandwidth_linear3` | Measures the linear bandwidth of a memory device. |\n| `sicm_bandwidth_random3` | Measures the random access bandwidth of a memory device. |\n\n## Arena Allocator API\n| Function Name | Description |\n|---------------|-------------|\n| `sicm_arenas_list` | List all arenas created in the arena allocator. |\n| `sicm_arena_create` | Create a new arena on the given device. |\n| `sicm_arena_destroy` | Frees up an arena, deleting all associated data structures. |\n| `sicm_arena_set_default` | Sets an arena as the default for the current thread. |\n| `sicm_arena_get_default` | Gets the default arena for the current thread. |\n| `sicm_arena_get_device` | Gets the device for a given arena. |\n| `sicm_arena_set_device` | Sets the memory device for a given arena. Moves all allocated memory already allocated to the arena. |\n| `sicm_arena_size` | Gets the size of memory allocated to the given arena. |\n| `sicm_arena_alloc` | Allocate to a given arena. |\n| `sicm_arena_alloc_aligned` | Allocate aligned memory to a given arena. |\n| `sicm_arena_realloc` | Resize allocated memory to a given arena. |\n| `sicm_arena_lookup` | Returns which arena a given pointer belongs to. |\n\n## High-Level Interface\nThe high-level interface is normally used with the compiler wrappers located in\n`bin/`. Users should use these wrappers to compile their applications, and a\ncompiler pass will automatically transform the code so that it calls the\nhigh-level interface with the appropriate arguments, including initialization,\ndestruction, and the proper allocation functions. Assuming the high-level\ninterface is linked to the application as a shared library, it automatically\ninitializes itself.  All heap allocation routines are replaced by calls to\n`void* sh_alloc(int id, size_t sz)`, which associates an ID with a given\nallocation and allocates the memory into an arena with other allocations of\nthat ID.\n\n## Programming Practices\n1. All blocks use curly braces\n   - Even one-line blocks\n2. Constants on the left side of `==`\n   - `if(NULL == foo) { ...`\n3. Functions with no arguments are `(void)`\n4. No C++-style comments in C code\n5. No GCC extensions except in GCC-only code\n6. No C++ code in libraries\n   - Discouraged in components\n7. Always define preprocessor macros\n   - Define logicals to 0 or 1 (vs. define or not define)\n   - Use `#if FOO`, not `#ifdef FOO`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanl%2Fsicm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flanl%2Fsicm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanl%2Fsicm/lists"}