10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-09-16 17:35:44 +02:00
QCaml/common/lib/qcaml.ml

33 lines
708 B
OCaml
Raw Normal View History

2020-09-26 12:02:53 +02:00
2023-06-16 18:27:23 +02:00
(* | ~root~ | Path to the QCaml source directory |
* | ~name~ | ~"QCaml"~ |
* | ~num_domains~ | Number of threads in parallel computations | *)
2020-12-28 01:08:55 +01:00
2020-12-28 01:55:03 +01:00
(* [[file:~/QCaml/common/qcaml.org::*QCaml][QCaml:2]] *)
2020-12-28 01:08:55 +01:00
let name = "QCaml"
2020-09-26 12:02:53 +02:00
let root =
let rec chop = function
2020-10-09 10:04:48 +02:00
| [] -> []
2020-09-26 12:02:53 +02:00
| x :: _ as l when x = name -> l
| _ :: rest -> chop rest
in
String.split_on_char Filename.dir_sep.[0] (Sys.getcwd ())
|> List.rev
|> chop
|> List.rev
|> String.concat Filename.dir_sep
2023-06-16 18:27:23 +02:00
let num_domains =
let result =
try
Unix.getenv "OMP_NUM_THREADS"
|> int_of_string
with Not_found -> 1
in
result - 1
2020-12-28 01:08:55 +01:00
(* QCaml:2 ends here *)