Skip to content

Commit

Permalink
Merge branch 'OpenCilk:dev' into fix-memory-alert-on-start
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-singer authored Jan 13, 2025
2 parents b2c3b88 + b71934c commit d617409
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 449 deletions.
1 change: 1 addition & 0 deletions .github/workflows/handcomp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}}
volumes:
- /mnt/:/mnt/
options: --user root
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/small-cilkapps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}}
volumes:
- /mnt/:/mnt/
options: --user root
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CMake build for Cheetah.

cmake_minimum_required(VERSION 3.13.4)
cmake_minimum_required(VERSION 3.20.0)

# Check if cheetah is built as a standalone project.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR CHEETAH_STANDALONE_BUILD)
Expand Down
70 changes: 31 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,49 @@
# The OpenCilk runtime system

This repository contains the source code of the OpenCilk runtime system. This library is intended to be used with the [OpenCilk compiler](https://github.com/OpenCilk/opencilk-project) and can either be built [together with the compiler](https://www.opencilk.org/doc/users-guide/build-opencilk-from-source/) or as a standalone library.

## Building a standalone copy of the OpenCilk runtime

These instructions assume that you are building the OpenCilk runtime system
using the OpenCilk compiler.
These instructions assume that you are building the OpenCilk runtime system using the OpenCilk compiler.

### Using Makefiles

1. If necessary, update the `COMPILER_BASE` variable in `config.mk` to point
to the directory containing the OpenCilk compiler binaries, e.g.,
`/path/to/opencilk-project/build/bin/`. When it executes `clang` and other
OpenCilk compiler binaries, the Makefile prepends this path to those
binaries.
1. If necessary, update the `COMPILER_BASE` variable in `config.mk` to point to the directory containing the OpenCilk compiler binaries, e.g., `/path/to/opencilk-project/build/bin/`. When it executes `clang` and other OpenCilk compiler binaries, the Makefile prepends this path to those binaries.
2. Run `make`.

To clean the build, run `make clean`.

### Using CMake

1. Make a build directory at the top level and enter it:
```
$ mkdir build
$ cd build
```
2. Configure CMake. Make sure to specify `CMAKE_C_COMPILER` and
`LLVM_CMAKE_DIR` to point to the corresponding build or installation
of the OpenCilk compiler binaries. In addition, set
`CMAKE_BUILD_TYPE` to specify the build type, such as, `Debug`, for an
unoptimized build with all assertions enabled; `Release`, for an fully
optimized build with assertions disabled; or `RelWithDebInfo`, to
enable some optimizations and assertions. (The default build type is
`Debug`.)

Example configuration:
```
$ cmake -DCMAKE_C_COMPILER=/path/to/opencilk-project/build/bin/clang -DCMAKE_BUILD_TYPE=Release -DLLVM_CMAKE_DIR=/path/to/opencilk-project/build ../
```

```console
mkdir build
cd build
```

2. Configure CMake. Make sure to specify `CMAKE_C_COMPILER`, `CMAKE_CXX_COMPILER`, and `LLVM_CMAKE_DIR` to point to the corresponding build or installation of the OpenCilk compiler binaries. In addition, set `CMAKE_BUILD_TYPE` to specify the build type, such as:

- `Debug`, for an unoptimized build with all assertions enabled (default);
- `Release`, for an fully optimized build with assertions disabled; or
- `RelWithDebInfo`, to enable some optimizations and assertions.

```console
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/path/to/opencilk-project/build/bin/clang -DCMAKE_CXX_COMPILER=/path/to/opencilk-project/build/bin/clang++ -DLLVM_CMAKE_DIR=/path/to/opencilk-project/build ../
```

3. Build the runtime:
```
$ cmake --build . -- -j<number of build threads>
```

To clean the build, run `cmake --build . --target clean` from the build
directory.
```console
cmake --build . -- -j<number of build threads>
```

## Linking against a standalone build of the OpenCilk runtime
To clean the build, run `cmake --build . --target clean` from the build directory.

The OpenCilk compiler accepts the flag
`--opencilk-resource-dir=/path/to/cheetah` to specify where to find all
relevant OpenCilk runtime files, including the runtime library, the
bitcode ABI file, and associated header files. This resource directory
should have `include/` and `lib/<target triple>` as subdirectories. For
example, if you built the standalone OpenCilk runtime using CMake, then
pass the flag `--opencilk-resource-dir=/path/to/cheetah/build` to the
OpenCilk compiler to link against that standalone build, e.g.,
```
## Using a standalone build of the OpenCilk runtime

The OpenCilk compiler accepts the flag `--opencilk-resource-dir=/path/to/cheetah` to specify where to find all relevant OpenCilk runtime files, including the runtime library, the bitcode ABI file, and associated header files. This resource directory should have `include/` and `lib/<target triple>` as subdirectories. For example, if you built the standalone OpenCilk runtime using CMake, then pass the flag `--opencilk-resource-dir=/path/to/cheetah/build` to the OpenCilk compiler to link against that standalone build as follows:

```console
/path/to/opencilk-project/build/bin/clang -o fib fib.c -fopencilk -O3 --opencilk-resource-dir=/path/to/cheetah/build
```
2 changes: 1 addition & 1 deletion cmake/Modules/AddCheetah.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function(add_cheetah_runtime name type)
if (NEED_EXPLICIT_ADHOC_CODESIGN)
add_custom_command(TARGET ${libname}
POST_BUILD
COMMAND codesign --sign - $<TARGET_FILE:${libname}>
COMMAND codesign --sign - -f $<TARGET_FILE:${libname}>
WORKING_DIRECTORY ${CHEETAH_OUTPUT_LIBRARY_DIR}
)
endif()
Expand Down
5 changes: 4 additions & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ CXX=$(COMPILER_BASE)clang++
LINK_CC=$(CC)
LLVM_LINK=$(COMPILER_BASE)llvm-link
LLVM_CONFIG=$(COMPILER_BASE)llvm-config
AR=ar
#AR=$(COMPILER_BASE)llvm-ar
#
ABI_DEF?=-DOPENCILK_ABI
# If use cheetah
Expand All @@ -20,7 +22,8 @@ RTS_PEDIGREE_LIB?=libopencilk-pedigrees
# All runtime libraries and associated files will be placed in
# `/oath/to/cheetah/lib/<target-triple>`, so that the compiler can easily find
# all of those files using the flag --opencilk-resource-dir=/path/to/cheetah.
RTS_LIBDIR_NAME?=lib/$(shell $(LLVM_CONFIG) --host-target)
TARGET?=$(shell $(LLVM_CONFIG) --host-target)
RTS_LIBDIR_NAME?=lib/$(TARGET)
RESOURCE_DIR?=$(CONFIG_DIR)
RTS_LIBDIR?=$(RESOURCE_DIR)/$(RTS_LIBDIR_NAME)
RTS_OPT?=-fopencilk --opencilk-resource-dir=$(RESOURCE_DIR)
Expand Down
Loading

0 comments on commit d617409

Please sign in to comment.