You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,6 +143,8 @@ Usage: [`./build.sh [OPTIONS]`](./build.sh) produces objects (`./obj/*.o`, for d
143
143
-`--abort-on-first-error`: sets [`SUSUWU_ABORT_ON_FIRST_ERROR=true`](./sh/Macros.sh), which causes [`SUSUWU_BUILD_OBJECTS`](./sh/make.sh) to `exit 1` if a subbuild ([`${CC}`](./build.sh) or [`${CXX}`](./build.sh)) fails.
144
144
- Environment flags: as [_GNU_`make`'s](https://www.gnu.org/software/make/manual/make.html#Implicit-Variables), plus;
145
145
-`export SUSUWU_SH_TPUT_COMMAND=<path>`; replaces calls to `tput` with `<path>` (for instance, with `no-such-command` to test that `SUSUWU_SH_COLOR_COUNT()` does not require `ncurses-utils`).
146
+
-`SUSUWU_IS_VIRTUAL` is set (`=true`) if [`./build.sh`](./build.sh) is executed through [_GitHub Workflows_](https://docs.github.com/en/actions/writing-workflows/about-workflows). TODO: test for other amnesiac environments (such as Docker).
147
+
-`SUSUWU_INSTALL_TENSORFLOW=true` to install [`libtensorflow`](https://github.com/tensorflow/tensorflow/) (+ prerequisites), `=false` to skip; default is `=${SUSUWU_IS_VIRTUAL}`.
146
148
- Macro flags (use `vim build.sh` to put into `FLAGS_USER`). If `=true`, most use more resources, except `SUSUWU*PREFER_*` or `SUSUWU*SKIP_*`. "default is `=!defined(NDEBUG)`" is short for; "if `--debug`, default `=true`, but if `--release`, default `=false`".
147
149
-`-DSUSUWU_UNIT_TESTS[=true|=false]` with `=true` to build + execute unit tests. Default is `=true`, but more stable future version could have default `=!defined(NDEBUG)`. If set to `=false`; compilation time, object size, execuable size reduced (to around half).
148
150
-`-DSUSUWU_HEX_DOES_PREFIX=true` to have `classIoHex*()` insert/remove "0x". Default is `=false` (caller must do).
C_SOURCE_PATH="./c/"#/* Usage: replace with directory root for _C_ source code */
34
34
CXX_SOURCE_PATH="./cxx/"#/* Usage: replace with directory root for _C++_ source code */
35
35
36
+
test -n "${GITHUB_ACTIONS}"#/* If `build.sh` is executed through [GitHub Workflows](https://docs.github.com/en/actions/writing-workflows/about-workflows). TODO: `|| <test for other amnesiac environments, such as Docker>` */
37
+
SUSUWU_IS_VIRTUAL=$?#/* Set to last command (`test`)'s return value */
38
+
SUSUWU_INSTALL_TENSORFLOW=${SUSUWU_IS_VIRTUAL}#/* If virtual, install prerequisites for `cxx/ClassTensorFlowCns.hxx`; use `export SUSUWU_INSTALL_TENSORFLOW=false` to reduce resource use, or `export SUSUWU_INSTALL_TENSORFLOW=true` to install prerequisites on all computers (default is to avoid changes to system unless virtual) */
39
+
if [ true="${SUSUWU_INSTALL_TENSORFLOW}" ];then
40
+
SUSUWU_PRINT "$0""$(SUSUWU_SH_NOTICE)""Was executed through one of GitHub's Workflows (or user set $(SUSUWU_SH_QUOTE "VAR""SUSUWU_INSTALL_TENSORFLOW")), will auto-install $(SUSUWU_SH_QUOTE "CODE""libeigen3-dev") and $(SUSUWU_SH_QUOTE "CODE""libtensorflow")."
TENSORFLOW_INCLUDE_PATH="${SUSUWU_DEPENDENCY_INCLUDE_PATH}"#/* `TENSORFLOW_INCLUDE_PATH=$(SUSUWU_DEPENDENCY_INCLUDE ...)` discards `SUSUWU_DEPENDENCY_INCLUDE`'s changes to env vars */
if! SUSUWU_DEPENDENCY_INCLUDE "-F""tensorflow:ml_dtypes""${TENSORFLOW_INCLUDE_PATH}${TENSORFLOW_PATH_PREFIX}""${ML_DTYPES_PREFIX}float8.h""cd ${TENSORFLOW_INCLUDE_PATH}${TENSORFLOW_PATH_PREFIX}${ML_DTYPES_ROOT}/ml_dtypes && bazel build";then# If can't use `ml_dtypes` from `tensorflow`
SUSUWU_DEPENDENCY_INCLUDE "-F""jax-ml:ml_dtypes""ml_dtypes/""${ML_DTYPES_PREFIX}float8.h""git clone ${ML_DTYPES_GIT} --depth 1"# use `ml_dtypes` from GitHub
71
+
if [ !-d"ml_dtypes" ] && [ true="${SUSUWU_INSTALL_TENSORFLOW}" ];then
72
+
git clone "${ML_DTYPES_GIT}" --depth 1
73
+
fi
74
+
if SUSUWU_DEPENDENCY_INCLUDE "-F""jax-ml:ml_dtypes""ml_dtypes/""${ML_DTYPES_PREFIX}float8.h""git clone ${ML_DTYPES_GIT} --depth 1";then# If can use `ml_dtypes` from GitHub
if [ -e"${ML_DTYPES_FALLBACK}float8.h" ];then# If fallback path has `float8.h`
78
+
SUSUWU_PRINT "$0""$(SUSUWU_SH_WARNING)""As last resort, will use $(SUSUWU_SH_QUOTE "PATH""${ML_DTYPES_FALLBACK}") (which has $(SUSUWU_SH_QUOTE "PATH""float8.h")) as path for $(SUSUWU_SH_QUOTE "CODE""ml_dtypes"). If this causes more $(SUSUWU_SH_QUOTE "CODE""#include") errors, execute $(SUSUWU_SH_QUOTE "CODE""cd ${XLA_SOURCE_PATH} && git reset --hard HEAD") or $(SUSUWU_SH_QUOTE "CODE""find \"${XLA_SOURCE_PATH}\" -type f -exec sed \"s|\\\"${ML_DTYPES_PREFIX}|\\\"${ML_DTYPES_FALLBACK_PREFIX}|\" -i'' {} +") to undo."
79
+
find "${XLA_SOURCE_PATH}" -type f -exec sed "s|\"${ML_DTYPES_PREFIX}|\"${ML_DTYPES_FALLBACK_PREFIX}|" -i'' {} + # [error: 'ml_dtypes/include/float8.h' file not found](https://github.com/tensorflow/tensorflow/issues/93130) fix. #TODO: filter with `grep "\.\(h\|cc\)$"`
@@ -76,6 +108,7 @@ if [ -n "${TENSORFLOW_INCLUDE_PATH}" ]; then #/* If `libtensorflow` was found */
76
108
SUSUWU_PRINT "$0""$(SUSUWU_SH_NOTICE)""$(SUSUWU_SH_QUOTE "CODE""${CXX}${SUSUWU_TENSORFLOW_TEST_PATH}") passed, will enable $(SUSUWU_SH_QUOTE "CODE""CXXFLAGS=\"\${CXXFLAGS} ${FLAGS_TENSORFLOW}\"")."
77
109
else
78
110
SUSUWU_PRINT "$0""$(SUSUWU_SH_NOTICE)""$(SUSUWU_SH_QUOTE "CODE""${CXX}${CXXFLAGS}${SUSUWU_TENSORFLOW_TEST_PATH}") failed, will not enable $(SUSUWU_SH_QUOTE "CODE""CXXFLAGS=\"\${CXXFLAGS} ${FLAGS_TENSORFLOW}\"") (skipped). If $(SUSUWU_SH_QUOTE "CODE""libtensorflow") is installed, insert $(SUSUWU_SH_QUOTE "CODE""${FLAGS_TENSORFLOW}") into $(SUSUWU_SH_QUOTE "CODE""$0:FLAGS_USER"). To troubleshoot, use $(SUSUWU_SH_QUOTE "CODE""cd ${TENSORFLOW_INCLUDE_PATH} && ./configure")"
111
+
# ${SUSUWU_USED_ML_DTYPES_SED} && find "${XLA_SOURCE_PATH}" -type f -exec sed "s|\"${ML_DTYPES_FALLBACK_PREFIX}|\"${ML_DTYPES_PREFIX}|" -i'' {} + # [error: 'ml_dtypes/include/float8.h' file not found](https://github.com/tensorflow/tensorflow/issues/93130) fix. #TODO: exclude 'third_party/xla/xla/tsl/platform/resource_loader.h'
SUSUWU_PRINT "SUSUWU_BUILD_CTAGS()""$(SUSUWU_SH_NOTICE)""Was called with less than 2 params; will default to $(SUSUWU_SH_QUOTE "CODE""SUSUWU_BUILD_CTAGS ${CTAGS_DEFAULTS}")."
0 commit comments