crystal-omp

C bindings for OpenMP.

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

Repository

crystal-omp

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • 8 months ago
  • April 7, 2024
License

MIT License

Links
Synced at

Sun, 22 Dec 2024 03:35:59 GMT

Languages