JuliaParallel / JuliaParallel/MPI.jl
Guidelines/rules for datatypes in constants files
- Dominant language
- Julia
- Stars
- 439
- Forks
- 127
- Avg merge
- 19h 6m
- Merged PRs (30d)
- 17
Description
I am currently looking through some of the constants files to understand which datatype is used when. For example, it seems like
```julia
@const_ref MPI_VARNAME Cint 12345
```
Is used both for constants defined as `enum`s and as `#define`s in the corresponding MPI implementation's `mpi.h`. Why is it OK to map these (ostensibly) different source types to the same Julia type? And why are some other constants defined as
```julia
const MPI_MAX_ERROR_STRING = Cint(256)
```
That is, as proper integer constants, even though in `mpi.h` they are also just `#define`s?
Also, I noticed that sometimes C types are translated to Julia C types and sometimes to regular Julia types, and for some there does not seem to be a 1-to-1 correspondence used. For example, for OpenMPI's there is
https://github.com/JuliaParallel/MPI.jl/blob/e4479cfe16f1fdbbdab7423eca03c98764b0c671/src/consts/openmpi.jl#L18-L21
While in the OpenMPI headers on HLRS' Hawk I find
* `MPI_Aint` to be of `ptrdiff_t` type, which is implementation defined (Q: isn't that a potential issue that it can vary?)
* `MPI_Fint` to be of `int` type (Q: why use `Int32` and not `Cint`?)
* `MPI_Count` and `MPI_Offset` to be of `long long` type (Q: why not use `Clong` then?)
Right afterwards in the definition of `MPI_Status`, the C types are used again:
https://github.com/JuliaParallel/MPI.jl/blob/e4479cfe16f1fdbbdab7423eca03c98764b0c671/src/consts/openmpi.jl#L24-L30
Maybe it is documented somewhere but I was not able to find it in the docs. Any help understanding how to properly understand (and possibly create) such a constants file would be appreciated!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.