Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 0 additions & 108 deletions .github/workflows/build-lightgbm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,115 +29,7 @@ env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

jobs:
omp_probe:
name: Probe libgomp and glibc malloc on riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 180
steps:
- name: Write the probe
run: |
cat > probe.c <<'PROBE_EOF'
/* Minimal riscv64 probe: OpenMP work-share vs glibc malloc under threads. */
#define _GNU_SOURCE
#include <omp.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static long alloc_body(int i) {
char *p = malloc(64 + (i & 255));
p[0] = (char)i;
long v = p[0];
free(p);
return v;
}

static long calc_body(int i) { return (long)i * 3 % 7; }

static int nthreads, nrounds, n;

static void *pth(void *arg) {
long s = 0;
for (int r = 0; r < nrounds; r++)
for (int i = 0; i < n; i++) s += alloc_body(i);
return (void *)s;
}

int main(int argc, char **argv) {
const char *kind = argc > 1 ? argv[1] : "guided-alloc";
nrounds = argc > 2 ? atoi(argv[2]) : 100000;
n = argc > 3 ? atoi(argv[3]) : 300;
nthreads = omp_get_max_threads();
long total = 0;
printf("kind=%s threads=%d rounds=%d n=%d\n", kind, nthreads, nrounds, n);
fflush(stdout);

if (!strcmp(kind, "pthread-alloc")) {
pthread_t t[64];
if (nthreads > 64) nthreads = 64;
for (int i = 0; i < nthreads; i++) pthread_create(&t[i], NULL, pth, NULL);
for (int i = 0; i < nthreads; i++) { void *r; pthread_join(t[i], &r); total += (long)r; }
printf("PROBE_OK %s %ld\n", kind, total);
return 0;
}

for (int r = 0; r < nrounds; r++) {
long s = 0;
if (!strcmp(kind, "guided-alloc")) {
#pragma omp parallel for num_threads(nthreads) schedule(guided) reduction(+ : s)
for (int i = 0; i < n; i++) s += alloc_body(i);
} else if (!strcmp(kind, "guided-calc")) {
#pragma omp parallel for num_threads(nthreads) schedule(guided) reduction(+ : s)
for (int i = 0; i < n; i++) s += calc_body(i);
} else if (!strcmp(kind, "static-alloc")) {
#pragma omp parallel for num_threads(nthreads) schedule(static) reduction(+ : s)
for (int i = 0; i < n; i++) s += alloc_body(i);
} else if (!strcmp(kind, "dynamic-alloc")) {
#pragma omp parallel for num_threads(nthreads) schedule(dynamic) reduction(+ : s)
for (int i = 0; i < n; i++) s += alloc_body(i);
} else {
fprintf(stderr, "unknown kind\n");
return 2;
}
total += s;
}
printf("PROBE_OK %s %ld\n", kind, total);
return 0;
}
PROBE_EOF
- name: Bare runner
run: |
set +e
gcc --version | head -1
nproc; head -2 /proc/meminfo
grep -E 'processor|isa|uarch|mmu|model|hart' /proc/cpuinfo | head -12
gcc -O2 -fopenmp -pthread -o probe probe.c
for kind in guided-calc static-alloc dynamic-alloc guided-alloc pthread-alloc; do
for i in 1 2 3; do
timeout 1200 ./probe "$kind" 100000 300 > out.log 2>&1
echo "### bare $kind attempt $i rc=$? $(tail -1 out.log)"
done
done
echo "### BARE DONE"
- name: Manylinux image
run: |
set +e
podman run -t --rm --network=host -v "${PWD}:/work" -w /work \
"${MANYLINUX_RISCV64_IMAGE}" bash -c '
gcc --version | head -1
gcc -O2 -fopenmp -pthread -o /tmp/probe /work/probe.c
for kind in guided-calc static-alloc dynamic-alloc guided-alloc pthread-alloc; do
for i in 1 2 3; do
timeout 1200 /tmp/probe "$kind" 100000 300 > /tmp/out.log 2>&1
echo "### container $kind attempt $i rc=$? $(tail -1 /tmp/out.log)"
done
done
echo "### CONTAINER DONE"
'
echo "### STEP DONE"
python_sdist:
if: github.run_id == '0' # probe-only run
name: Build lightgbm ${{ inputs.version || '4.7.0' }} sdist
runs-on: ubuntu-latest
outputs:
Expand Down
Loading