crystal-omp

Version, currently master branch1 version
  • master branchlatestApr 10, 2024

github.com/Oblivious-Oblivious/crystal-omp

C bindings for OpenMP.

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  crystal-omp:
    github: Oblivious-Oblivious/crystal-omp
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
>= 1.11.2
License
MIT
Author
Oblivious

Dependencies

This version declares no dependencies.

README

crystal-omp

OpenMP integration for Crystal. Supported up to latest version.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      crystal-omp:
        github: Oblivious-Oblivious/crystal-omp
  2. Run shards install

Usage

require "crystal-omp"

Try examples for more.

cat function.c

int run_in_c(char *value) {
  #pragma omp parallel
  for(;;);
  printf("%s\n", value);
  return 42;
}

cat test.cr

@[Link(ldflags: "#{__DIR__}/function.o")]
lib LibTest
  fun run_in_c(LibC::Char*) : LibC::Int;
end

res = LibTest.run_in_c "somestring";
pp res;
clang -fopenmp -o function.o function.c
crystal test.cr

Development

  1. Tests for binded functionality
  2. Wrapper objects for converting safe values to unsafe ones

Contributing

  1. Fork it (https://github.com/Oblivious-Oblivious/crystal-omp/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors