Skip to content

Conversation

@jturner314
Copy link
Contributor

Before, the build script ignored differing versions of the C and Fortran compilers; it built OpenBLAS in a directory named only by the target. Now, the build script gets information about the build environment, including the C and Fortran compiler versions, and includes a hash of that information in the build directory name. It also writes the build information to a file named .openblas-src_build_info in the build directory to help with debugging.

The result of this change is that when the C or Fortran compiler is changed (e.g. by a system update or by the user specifying the compiler version in environment variables), OpenBLAS will be rebuilt.

The hasher selected for hashing the build information is std::collections::hash_map::DefaultHasher::new() simply because it's included in the standard library, so the build script doesn't need extra dependencies. The disadvantage of this hasher is that its output is not guaranteed to be stable across different Rust releases. As a result, with a new Rust release, OpenBLAS may be rebuilt unnecessarily.

Before, the build script ignored differing versions of the C and
Fortran compilers; it built OpenBLAS in a directory named only by the
target. Now, the build script gets information about the build
environment, including the C and Fortran compiler versions, and
includes a hash of that information in the build directory name. It
also writes the build information to a file named
`.openblas-src_build_info` in the build directory to help with
debugging.

The result of this change is that when the C or Fortran compiler is
changed (e.g. by a system update or by the user specifying the
compiler version in environment variables), OpenBLAS will be rebuilt.

The hasher selected for hashing the build information is
`std::collections::hash_map::DefaultHasher::new()` simply because it's
included in the standard library, so the build script doesn't need
extra dependencies. The disadvantage of this hasher is that its output
is not guaranteed to be stable across different Rust releases. As a
result, with a new Rust release, OpenBLAS may be rebuilt
unnecessarily.
This avoids potential confusion with the directory named "source".
@IvanUkhov
Copy link
Member

Wow, it’s quite a bit of changes plus a new file. I need some time to think about it.

If not yet enabled, please allow me to push to this branch.

@jturner314
Copy link
Contributor Author

Yeah, it took more work than I expected. Unfortunately, the logic OpenBLAS uses to select the compiler is somewhat complicated, so the simplest solution was to use a makefile to call the existing logic rather than try to replicate it in Rust. The echo-build-info rule in make_build_info is based on the all rule located in source/Makefile. The reason for hashing the build information is that it's too long to put directly in the build directory name.

Please feel free to edit the PR or let me know if you'd like me to make changes.

@IvanUkhov
Copy link
Member

Since #31 is merged, I close this for now.

@IvanUkhov IvanUkhov closed this Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants