Skip to content

Commit bea26c7

Browse files
committed
Minor fixes
1 parent b448cc7 commit bea26c7

7 files changed

Lines changed: 33 additions & 14 deletions

File tree

build.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ set -e
1919
# ./build.sh constellation # Sweep dashboard -> ./seethestars
2020
# ./build.sh cache_data # Sweep log cache -> ./cache_data
2121
# ./build.sh trailer # 5.0 trailer -> ./resources/trailer/trailer (also exports diagrams)
22-
# ./build.sh all # Build all envs native and native float32
2322
#
2423
# Env is compiled in. Run: ./puffer train|eval|match|sweep [--section.key=value ...]
2524

@@ -99,6 +98,7 @@ fi
9998
CLANG_WARN=(
10099
-Wall
101100
-Wno-narrowing
101+
-Wno-unreachable-code
102102
-ferror-limit=3
103103
-Werror=incompatible-pointer-types
104104
-Werror=return-type
@@ -370,7 +370,7 @@ elif [ "$MODE" = "web" ]; then
370370
emcc \
371371
-o "build/web/$ENV/game.html" \
372372
src/puffercpu.c $EXTRA_SRC \
373-
-O3 -Wall -Wno-narrowing \
373+
-O3 -Wall -Wno-narrowing -Wno-unreachable-code \
374374
"${LINK_ARCHIVES[@]}" \
375375
-I. -Isrc -I$SRC_DIR -Ivendor "${INCLUDES[@]}" \
376376
-L. -L./$RAYLIB_NAME/lib \
@@ -466,8 +466,15 @@ ENV_COMPILE_FLAGS=(-DENV_HEADER=\"$ENV_HEADER\")
466466

467467
MODE=${MODE:-native}
468468

469-
# Allow double→int/float in brace-init (host -Wno-narrowing + nvcc #2361).
470-
NVCC_NARROW=(-Xcompiler=-Wno-narrowing --diag-suppress=2361)
469+
# Brace-init narrowing (host -Wno-narrowing + nvcc #2361) and unreachable
470+
# code in env headers (clang -Wunreachable-code, nvcc #111/#128).
471+
NVCC_NARROW=(
472+
-Xcompiler=-Wno-narrowing
473+
-Xcompiler=-Wno-unreachable-code
474+
--diag-suppress=2361
475+
--diag-suppress=111
476+
--diag-suppress=128
477+
)
471478

472479
if [ "$MODE" = "native" ]; then
473480
if [ -n "$OUT" ]; then
@@ -486,14 +493,16 @@ if [ "$MODE" = "native" ]; then
486493
OSRS_RENDER_OBJECT="build/osrs_puffer_render.o"
487494
ENV_COMPILE_FLAGS+=(-DOSRS_PUFFER_RENDER)
488495
$CC $LINK_OPT "${CLANG_WARN[@]}" "${SIMD_FLAGS[@]}" -std=c11 \
496+
-Wno-unused-function \
497+
-D_POSIX_C_SOURCE=200809L \
489498
-I. -Isrc -I$SRC_DIR -Ivendor \
490499
"${INCLUDES[@]}" \
491500
-DPLATFORM_DESKTOP \
492501
-c ocean/osrs/osrs_puffer_render.c \
493502
-o "$OSRS_RENDER_OBJECT"
494503
;;
495504
esac
496-
echo "Compiling native train/eval binary ($ARCH) -> $TRAIN_BIN..."
505+
echo "Compiling $ENV_HEADER -> $TRAIN_BIN..."
497506
$NVCC $NVCC_OPT -arch=$ARCH -std=c++17 \
498507
-I. -Isrc -I$SRC_DIR -Ivendor \
499508
"${INCLUDES[@]}" \
@@ -514,13 +523,13 @@ if [ "$MODE" = "native" ]; then
514523
-L$CUDA_HOME/lib64 $NCCL_LFLAG \
515524
"${EXTRA_LDFLAGS[@]}" \
516525
-lcudart -lnccl -lnvidia-ml -lcublas -lcusolver -lcurand \
517-
-lm -lpthread $OMP_LIB "${STANDALONE_LDFLAGS[@]}" \
526+
-lm -Xlinker=-lpthread $OMP_LIB "${STANDALONE_LDFLAGS[@]}" \
518527
-o "$TRAIN_BIN"
519528
echo "Built: ./$TRAIN_BIN"
520529

521530
elif [ "$MODE" = "profile" ]; then
522531
PROFILE_BIN="build/profile_${ENV}"
523-
echo "Compiling profile binary ($ARCH) -> $PROFILE_BIN..."
532+
echo "Compiling $ENV_HEADER -> $PROFILE_BIN..."
524533
$NVCC $NVCC_OPT -arch=$ARCH -std=c++17 \
525534
-I. -Isrc -I$SRC_DIR -Ivendor \
526535
"${INCLUDES[@]}" \
@@ -537,7 +546,7 @@ elif [ "$MODE" = "profile" ]; then
537546
"$RAYLIB_A" \
538547
-L$CUDA_HOME/lib64 \
539548
-lnccl -lnvidia-ml -lcublas -lcusolver -lcurand \
540-
-lGL -lm -lpthread $OMP_LIB \
549+
-lGL -lm -Xlinker=-lpthread $OMP_LIB \
541550
-o "$PROFILE_BIN"
542551
echo "Built: ./$PROFILE_BIN"
543552
fi

ocean/osrs/encounters/inferno/encounter_inferno_helpers.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ typedef struct InfRouteBakeHeader {
828828
uint64_t revision_base;
829829
} InfRouteBakeHeader;
830830

831-
_Static_assert(sizeof(InfRouteBakeHeader) == 64,
831+
static_assert(sizeof(InfRouteBakeHeader) == 64,
832832
"inferno route bake header must stay 64 bytes");
833833

834834
static const char INF_ROUTE_BAKE_MAGIC[8] = {

ocean/osrs/osrs_assets.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#ifndef OSRS_ASSETS_H
22
#define OSRS_ASSETS_H
33

4+
#ifndef _POSIX_C_SOURCE
5+
#define _POSIX_C_SOURCE 200809L
6+
#endif
7+
48
#include <stdio.h>
59
#include <stdlib.h>
610
#include <string.h>

ocean/osrs/osrs_env_profile.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef _POSIX_C_SOURCE
2+
#define _POSIX_C_SOURCE 200809L
3+
#endif
14
#include <stdlib.h>
25
#include <time.h>
36

ocean/osrs/osrs_puffer_render.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef _POSIX_C_SOURCE
2+
#define _POSIX_C_SOURCE 200809L
3+
#endif
14
#define OSRS_VISUAL
25

36
#include <stdlib.h>

ocean/osrs/osrs_visual.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef _POSIX_C_SOURCE
2+
#define _POSIX_C_SOURCE 200809L
3+
#endif
14
#include <stdio.h>
25
#include <stdlib.h>
36
#include <string.h>

ocean/osrs/scripts/setup-data.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ if [ "${OSRS_ASSET_SETUP_FORCE:-0}" != "1" ]; then
5353
echo "setup-osrs-data: loose assets satisfy ${archive_name}"
5454
exit 0
5555
fi
56-
echo "setup-osrs-data: missing required loose assets"
57-
while IFS=$'\t' read -r group_name asset_path; do
58-
[ -n "${asset_path}" ] || continue
59-
echo "setup-osrs-data: missing ${group_name}: ${asset_path}"
60-
done < "${MISSING_TSV}"
56+
missing_count=$(grep -c $'\t' "${MISSING_TSV}" || true)
57+
echo "setup-osrs-data: missing ${missing_count} required loose assets; installing ${archive_name}"
6158
fi
6259

6360
archive_path="${DOWNLOAD_DIR}/${archive_name}"

0 commit comments

Comments
 (0)