Occa

Latest version: v0.4.1

Safety actively analyzes 681790 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 4

70.2

| Part of code | % Coverage Change | LOC Coverage Change |
| --------------- | ------------------------------------- | ----------------------------------- |
| Headers | `74.7%` → `91.5%` _(`+16.8%`)_ | `714` → ` 1374` _(`+660`)_ |
| C API | `24.1%` → `99.4%` _(`+75.3%`)_ | `139` → ` 655` _(`+516`)_ |
| C++ API | `58.0%` → `67.0%` _(`+ 9.0%`)_ | `8347` → `10374` _(`+2027`)_ |
| IO Tooling | `62.2%` → `97.3%` _(`+35.1%`)_ | `225` → ` 326` _(`+101`)_ |
| General Tooling | `51.0%` → `63.7%` _(`+12.7%`)_ | `1249` → ` 1524` _(`+275`)_ |
| OKL Parser | `61.4%` → `63.7%` _(`+ 2.3%`)_ | `6479` → ` 7063` _(`+584`)_ |

C++

- [0effcc1c8ed173d72a99078d9971b9eafafec4f4] Added `occa::exception`

C

- [9c6e5ea61027198889abe4c2e201e40bbd759ef6] Added `occaPropertiesHas`
- [6b06820cf963b7dfeeee81e7fc02d78fad264ada] Added `occaFreeUvaPtr`
- [90cf5d5407b0eaa20ab25132f065f37213aab361] Added `occaUndefined` and `occaIsUndefined`
- [87e700032400038460be449c091a57a865a73b26] Added `occaIsDefault`

Misc

- [e529137738bee329413a39dea6f8f0160e8f5a1a][154] CLI options that take arguments can be passed as: `-Dfoo=1` → `-D foo=3`
- [3707f9ee4b0e61ba1eefc24bfb82405c075dbe67] Examples have arg parsing to make them more interactive
- [dae53084bed303c2fe7999f18f0026aae6bb97f0] `occa::sys::rmrf` cannot delete any path that has less than 2 parent directories (e.g. `/` or `/usr/bin`) without:

cpp
occa::settings()["options/safe-rmrf"] = false;


:bug: Bugs Fixed

- [855e9679d570b7548f7853ff7f4e4eb3d0b85391] Exclusive array was set at the end, not beginning
- [5df9319770cc38874a995d9ba85f9132d0976b7e] OpenMP was using Serial parser
- [63c125821ec4a2228ab7ad342c2f846262eb17ee] String merging now works between newlines
- [ff4310d09b6cbf764e84751fc458767b44470229] Fixed bug using occa::memcpy with 2 non-occa pointers
- [dae53084bed303c2fe7999f18f0026aae6bb97f0] Failed kernel compilations now clear the cache directory
- [dae53084bed303c2fe7999f18f0026aae6bb97f0] Non-conforming OKL kernels now properly fail

1.0.8

:loudspeaker: Annoucement

Python API released!

Check it out at [libocca/occa.py](https://github.com/libocca/occa.py) or install running

sh
pip install occa


- Most of the core API is ported to Python
- Numpy arrays are used seamlessly with `occa.memory` objects
- First steps to supporting JIT-compiled Python functions as OKL kernels:

python
okl.kernel
def py_add_vectors(a: Const[List[np.float32]],
b: Const[List[np.float32]],
ab: List[np.float32]) -> None:
for i in okl.range(entries).tile(16):
ab[i] = a[i] + b[i]

↓
cpp
kernel void py_add_vectors(const float *a,
const float *b,
float *ab) {
for (int i = 0; i < entries; ++i; tile(16, outer, inner)) {
ab[i] = a[i] + b[i];
}
}


⭐️ Features

- [54f400321cf129f5cdc0768f53b1e4da8a3cd0fe] Added dtypes which can be optionally used for runtime type checking

- New class `occa::dtype_t`
- Optional typed `occa::memory` allocation

cpp
occa::malloc(10 * sizeof(float)); // Regular malloc
occa::malloc(10, occa::dtype::float_); // Typed malloc
occa::malloc(10, occa::dtype::get<float>()); // Templated typed malloc


c
occaMalloc(10 * sizeof(float), NULL, occaDefault); // Regular malloc
occaTypedMalloc(10, occaDtypeFloat, NULL, occaDefault); // Typed malloc


- API for creating custom dtypes, for example:

cpp
occa::dtype_t vec3; // { float x, y, z }
vec3.addField("x", occa::dtype::float_);
vec3.addField("y", occa::dtype::float_);
vec3.addField("z", occa::dtype::float_);


- [994eb2a5fed533d16392b96465036a2c07fa1459] Added more kernel methods for the C API

c
void occaKernelPushArg(occaKernel kernel,
occaType arg);

void occaKernelClearArgs(occaKernel kernel);

void occaKernelRunFromArgs(occaKernel kernel);

void occaKernelVaRun(occaKernel kernel,
const int argc,
va_list args);


- [f6333f2c808ddd29399b1f7ea0def461050d9d0c] Custom kernel library paths, for example:

cpp
// Application code
occa::io::addLibraryPath("mylibrary", "./path/to/kernels/dir");
occa::io::addLibraryPath("mylibrary", "${MY_LIBRARY_DIR}");

// Kernel
include "occa://mylibrary/kernel.okl"


🐛 Bugs Fixed

- [0c975e18088df5495bc4d63f4f3000c5415cf9a0] Modes can run a check before registering themselves, letting badly installed OpenCL/CUDA/HIP become disabled at runtime

- [f5f0e81d271837b2132dc34c90bd4163ed58f95e] OpenCL in newer MacOS versions don't seem to support loading program binaries. We now avoid storing the binary in these cases

1.0.7

⚠️ Breaking Changes

- [cd687082554d630259b8a3d52c51a4c0f9c6f0f5] Updated `wrapMemory` to take in an `occa::device` and `occa::properties`

**Before**

occa::cpu::wrapMemory(void* ptr, const udim_t bytes)

**After**

occa::cpu::wrapMemory(occa::device device, void* ptr, const udim_t bytes, occa::properties props)


- [959ec4a7e1d28876d7dc81804cfcd99cd356adb7] Renamed `occaSetDeviceFromInfos` to fit the rest of the methods

**Before**

occaSetDeviceFromInfos(const char *info)

**After**

occaSetDeviceFromString(const char *info)


- [7735c669eb001b7c00d4b56ec2cbb61d1a4f8b27] Removed some redundant stream methods

**Before**
cpp
occa::device::freeStream(occa::stream) // C++
occaDeviceFreeStream(occaStream) // C


**After (Not new)**
cpp
occa::stream::free() // C++
occaFree(occaStream) // C


- [f81054dfacc83b4897e459c55edb2badd85b4caf] Removed `occa::opencl::event()` and moved it to `occa::opencl::streamTag::clEvent`
- [f81054dfacc83b4897e459c55edb2badd85b4caf] Removed `occa::cuda::event()` and moved it to `occa::cuda::streamTag::cuEvent`
- [f81054dfacc83b4897e459c55edb2badd85b4caf] Removed `occa::streamTag::tagTime`. Tags can only be used for:

- Waiting for queued tasks to finish (_e.g. launched kernels or memory copies_)
- Time gaps between 2 tags

⭐️ Features

- [daf030050355415888b2c10b01300f817dfabebd] Faster `make` build and added `make info` v-dobrev
- [1024a62072c3ee7bcbcf6e8991eb7be852165ec9] Switched garbage collection strategy to `NULL` out existing device/kernel/memory objects when one is freed. This switches `SEGFAULT` issues to `occa::exception` errors that can be more easily debugged.
- [527494c949e95451f491c710592e9cd91e52b56f] Linalg methods reuse device buffers for reductions
- [ce46013ba795f4c1863d63140aa05c4fa8e013a2] Loading cached kernels are sped up by avoiding locks if possible
- [e27b29e9ce64be2289075ecd522a5b0d48ba1e67] Added `occaJson`
- [fdd2d7c342cd82b5084a5edd626b8e94d44a85e8] Added `occaCreateDeviceFromString`
- [fdd2d7c342cd82b5084a5edd626b8e94d44a85e8] Added CLI to C exampleOpenCL mode
- [959ec4a7e1d28876d7dc81804cfcd99cd356adb7] Added UVA methods to C API
- [7735c669eb001b7c00d4b56ec2cbb61d1a4f8b27] The `occa::stream` class can now be extended
- [f81054dfacc83b4897e459c55edb2badd85b4caf] The `occa::streamTag` class can now be extended

🐛 Bugs Fixed

- [99ce6fb54fed6e28abb2db2e006565c05a9edbd2] Linalg properly deletes array allocations jdahm
- [b7384bcc0eb64edfd74211a99a5024c94c291c7d] Kernel hashes is generated only from needed props (e.g. ignores `verbose`)
- [780a06ae273ea037bf21452600ffdb17b93a312c] OpenCL `__global`, `__local`, and `__kernel` are properly inserted in the beginning
- [dba0db9741f627baed9f13f245e2ca791515d1d5] `memory::slice` was improperly freeing UVA pointers in
- [3260a053eedb53867391610895f03d03a4e8599c] The `verbose` property was being overwritten in CUDA mode

🎉 Contributors

- v-dobrev
- jdahm

1.0.6

⚠️ Breaking Changes

- [4199d8f7a6c2f1767262b8dfbfa21669e5fc4914] Removed `occa::cuda::getMappedPtr` and `occa::opencl::getMappedPtr` and replaced them with

occa::memory::ptr("mapped: true")


- [4199d8f7a6c2f1767262b8dfbfa21669e5fc4914] Allocating mapped/pinned memory (CUDA, OpenCL)

It was too verbose and not as flexible to pass

cuda: { mapped: true }
opencl: { mapped: true }

It's now the same for both CUDA and OpenCL

mapped: true


- [4199d8f7a6c2f1767262b8dfbfa21669e5fc4914] Allocating unified memory (CUDA)

The driver API uses the method `cuMemAllocManaged` so the prop was named accordingly

cuda: { managed: true }

However, most users know this feature as unified memory so we're switching the prop name to `unified`.
Similar to mapped allocation, it has been shortened to

unified: true


C

- [1f513fc1194d1a529f04cd07c92e106a74cab07e] `occaMemoryPtr(occaMemory)` &rarr; `occaMemoryPtr(occaMemory, occaProperties)`

⭐️ Features

- [4199d8f7a6c2f1767262b8dfbfa21669e5fc4914] Added `occa::memory::ptr(occa::properties)`
- [abc3bea7f4a4b414c5921766bdd84f629b225aec] Added `pragma occa attributes` option


cpp
pragma occa attributes kernel
void addVectors(const int entries,
const float *a,
const float *b,
float *ab) {
pragma occa attributes tile(16, outer, inner)
for (int i = 0; i < entries; ++i) {
ab[i] = a[i] + b[i];
}
}


&darr;

cpp
kernel void addVectors(const int entries,
const float *a,
const float *b,
float *ab) {
for (int i = 0; i < entries; ++i; tile(16, outer, inner)) {
ab[i] = a[i] + b[i];
}
}


🐛 Bugs Fixed

- [b41ed3477ca9fa946de21ea62bce11ad38a98afb] UVA range checks had incorrect inclusive end
- [1f513fc1194d1a529f04cd07c92e106a74cab07e] Preprocessor treats undefined identifiers as 0 (Thanks pdhahn!)

1.0.5

:warning: Breaking Changes

C++
- [e529137738bee329413a39dea6f8f0160e8f5a1a] Removed `occa::getKernelProperties()`
- [d88218a726624828d36681e4bc92577da82188d9] For UVA pointers:`occa::free` &rarr; `occa::freeUvaPtr`

C

- [6e895de5507d50ede0c82a1a671905af3f9c9dbe] `occaDeviceUmalloc` &rarr; `occaDeviceUMalloc`
- [6e895de5507d50ede0c82a1a671905af3f9c9dbe] `occaWaitFor` &rarr; `occaWaitForTag`
- [6e895de5507d50ede0c82a1a671905af3f9c9dbe] `occaDeviceWaitFor` &rarr; `occaDeviceWaitForTag`
- [6e895de5507d50ede0c82a1a671905af3f9c9dbe] `occaTimeBetween` &rarr; `occaTimeBetweenTags`
- [6e895de5507d50ede0c82a1a671905af3f9c9dbe] `occaDeviceTimeBetween` &rarr; `occaDeviceTimeBetweenTags`

:star: Features

1.0.4

:warning: Breaking Changes

Memory
- 405fb3508a136e2e69a3ab6995e7df66c7d103ef Renamed `occa::opencl::getCLMappedPtr` &rarr; `occa::opencl::getMappedPtr`

:star: Features

Kernel
- 1cc0da81d056ccd0829ac3b46f464ffd3c0633b7 Kernels can be run with 0 arguments

Memory
- 405fb3508a136e2e69a3ab6995e7df66c7d103ef Added `getMappedPtr` for OpenCL and CUDA

OKL
- 5d5865d0d20b7d6aa1d2595a2d88492de1a0993a [:tada: noelchalmers] Added HIP Backend

:bug: Bugs Fixed
- fbcc86fe075a720983e7041c141ab4c28a50f96c Fixed switch printing
- e0eeaf1272e5c3e66ba21fb5e5d42351580d74a3 elifStatement had extra `popUp`
- 6f4f5c1cf098d7436db11ecca5b0aa31a8e0d9d7 [:tada: jdahm] XL compiler missing header

:tada: Contributors

noelchalmers
jdahm

Page 1 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.