Skip to content

Commit

Permalink
Merge pull request #241 from alphaville/feature/240
Browse files Browse the repository at this point in the history
Allocators
  • Loading branch information
alphaville authored Oct 27, 2021
2 parents 6580b17 + b4f07a6 commit ed18e4a
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 70 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
with:
python-version: '3.8'
architecture: 'x64'
- run: cargo test --features rp
- run: cargo test --features jem
- run: bash ./ci/script.sh

ci_macos:
Expand All @@ -52,4 +54,6 @@ jobs:
with:
python-version: '3.8'
architecture: 'x64'
- run: cargo test --features rp
- run: cargo test --features jem
- run: bash ./ci/script.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by Cargo
# will have compiled files and executables
.eggs
.idea
TODOS/
/target
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ Note: This is the main Changelog file for the Rust solver. The Changelog file fo

### Changed

* Removed unnecessary #[no_mangle] annotations
* Removed unnecessary `#[no_mangle]` annotations
* Took care of additional clippy warnings

### Added

* Support for [`rpmalloc`](https://github.com/EmbarkStudios/rpmalloc-rs) and [`jemalloc`](https://github.com/gnzlbg/jemallocator) using the features `jem` and `rp`

### Changed

* Bump versions: `cbindgen`: `0.8 --> 0.20` and `libc`: `0.2.0 -> 0.2.*`

<!-- ---------------------
v0.7.1-alpha.1
Expand Down
15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,26 @@ num = "0.2.0"
# Our own stuff - L-BFGS: limited-memory BFGS directions
lbfgs = "0.2"

# sc-allocator provides an implementation of a bump allocator
rpmalloc = { version = "0.2.0", features = ["guards", "statistics"], optional = true }

# jemallocator is an optional feature; it will only be loaded if the feature
# `jem` is used (i.e., if we compile with `cargo build --features jem`)
[target.'cfg(not(target_env = "msvc"))'.dependencies]
jemallocator = {version = "0.3.2", optional = true}




# --------------------------------------------------------------------------
# F.E.A.T.U.R.E.S.
# --------------------------------------------------------------------------
[features]
# Use `jemallocator` as a global memory allocator (requires the dependency
# `jemallocator` - see above)
jem = ["jemallocator"]
rp = ["rpmalloc"]

# --------------------------------------------------------------------------
# T.E.S.T. D.E.P.E.N.D.E.N.C.I.E.S
# --------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion docs/python-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ Note that you need to install the necessary target first.
| `with_build_directory` | Target build directory; the default is `.` |
| `with_build_mode` | `release` or `debug`; the default option is `release`, which requires more time to compile, but leads to high performance executables; use `debug` for faster compilation, at the cost of lower performance (this is useful when experimenting with OpEn) |
| `with_tcp_interface_config` | Enable TCP server; provide configuration |
| `with_target_system` | Target system |
| `with_target_system` | Target system (to be used when you need to cross-compile) |
| `with_build_c_bindings` | Enalbe generation of C/C++ bindings |
| `with_rebuild` | Whether to do a clean build |
| `with_open_version` | Use a certain version of OpEn (see [all versions]), e.g., `with_open_version("0.6.0")`, or a local version of OpEn (this is useful when you want to download the latest version of OpEn from github). You can do so using `with_open_version(local_path="/path/to/open/")`. |
|`with_allocator` | Available in `opengen >= 0.6.6`. Compile with a different memory allocator. The available allocators are the entries of `RustAllocator`. OpEn currently supports [Jemalloc](https://github.com/gnzlbg/jemallocator) and [Rpmalloc](https://github.com/EmbarkStudios/rpmalloc-rs).|

[all versions]: https://crates.io/crates/optimization_engine/versions

Expand Down
2 changes: 2 additions & 0 deletions docs/python-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ following types of constraints:
|--------------------|------------------------------------------------|
| `Ball2` | Euclidean ball: `Ball2(None, r)` creates a Euclidean ball of radius `r` centered at the origin, and `Ball2(xc, r)` is a ball centered at point `xc` (list) |
| `BallInf` | Ball of infinity norm:`BallInf(None, r)` creates an infinity-norm ball of radius `r` centered at the origin, and `BallInf(xc, r)` is an infinity ball centered at point `xc` (list) |
| `Ball1` | Coming Soon (see [#238](https://github.com/alphaville/optimization-engine/issues/238))|
| `Simplex` | Simplex Soon (see [#234](https://github.com/alphaville/optimization-engine/issues/234)) |
| `Halfspace` | A halfspace is a set of the form $\\{u \in \mathbb{R}^{n_u} {}:{} \langle c, u\rangle \leq b \\}$, for a vector $c$ and a scalar $b$. The syntax is straightforwarrd: `Halfspace(c, b)`. |
| `FiniteSet` | Finite set, $\\{u^{(1)},\ldots,u^{(m)}\\}$; the set of point is provided as a list of lists, for example, `FiniteSet([[1,2],[2,3],[4,5]])`. The commonly used set of binary numbers, $\\{0, 1\\}$, is created with `FiniteSet([[0], [1]])`. |
| `NoConstraints` | No constraints - the whole $\mathbb{R}^{n}$|
Expand Down
5 changes: 4 additions & 1 deletion open-codegen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Note: This is the Changelog file of `opengen` - the Python interface of OpEn

### Added

* Support for [`rpmalloc`](https://github.com/EmbarkStudios/rpmalloc-rs) and [`jemalloc`](https://github.com/gnzlbg/jemallocator) using `BuildConfiguration.with_allocator`
* Implementation/testing of projection on simplices (`simplex.py`) (addresses #234)
*-* Implementation/testing of projection on Ball-1 (`ball1.py`) (addresses #238)
* Implementation/testing of projection on Ball-1 (`ball1.py`) (addresses #238)
* `# Safety` section in auto-generated unsafe auto-generated Rust code


### Removed

* Unnecessary `#[no_mangle]`s in auto-generated Rust code
Expand All @@ -30,6 +32,7 @@ Note: This is the Changelog file of `opengen` - the Python interface of OpEn
### Changed

* Include `VERSION` file in `MANIFEST.in` (included in Python package)
* Bump versions: `cbindgen`: `0.8 --> 0.20.*` and `libc`: `0.2.0 -> 0.2.*`


## [0.6.4] - 2020-10-21
Expand Down
Loading

0 comments on commit ed18e4a

Please sign in to comment.