Skip to content

Commit

Permalink
Split the API into modules
Browse files Browse the repository at this point in the history
  • Loading branch information
lukstafi committed Sep 23, 2024
1 parent f6d5821 commit 1453495
Show file tree
Hide file tree
Showing 6 changed files with 2,312 additions and 2,260 deletions.
12 changes: 11 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
## [0.4.1] current
## [0.5.0] current

### Added

- TODO: CUDA events.

### Changed

- Partitioned the API into modules.

## [0.4.1] 2024-09-12

### Fixed

Expand Down
17 changes: 9 additions & 8 deletions bin/properties.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ module Cu = Cudajit

let () =
Cu.init ();
let num_gpus = Cu.device_get_count () in
let num_gpus = Cu.Device.get_count () in
Format.printf "\n# GPUs: %d\n%!" num_gpus;
let gpus = List.init num_gpus (fun ordinal -> Cu.device_get ~ordinal) in
let gpus = List.init num_gpus (fun ordinal -> Cu.Device.get ~ordinal) in
List.iteri
(fun ordinal dev ->
let props = Cu.device_get_attributes dev in
Cu.ctx_set_current @@ Cu.device_primary_ctx_retain dev;
let ctx_flags = Cu.ctx_get_flags () in
let props = Cu.Device.get_attributes dev in
Cu.Context.set_current @@ Cu.Context.get_primary dev;
let ctx_flags = Cu.Context.get_flags () in
Format.printf "GPU #%d:@ %a@\nContext properties:@ %a@\n%!" ordinal Sexplib0.Sexp.pp_hum
(Cu.sexp_of_device_attributes props)
Sexplib0.Sexp.pp_hum (Cu.sexp_of_ctx_flags ctx_flags);
(Cu.Device.sexp_of_attributes props)
Sexplib0.Sexp.pp_hum
(Cu.Context.sexp_of_flags ctx_flags);
Format.printf "Default limits:@ %a\n%%!" Sexplib0.Sexp.pp_hum
(Sexplib0.Sexp_conv.(
sexp_of_list (fun li ->
sexp_of_pair Cu.sexp_of_limit sexp_of_int (li, Cu.ctx_get_limit li)))
sexp_of_pair Cu.Context.sexp_of_limit sexp_of_int (li, Cu.Context.get_limit li)))
[
STACK_SIZE;
PRINTF_FIFO_SIZE;
Expand Down
Loading

0 comments on commit 1453495

Please sign in to comment.