Compare commits

..

No commits in common. "8565ce782bd86aea3d89cf736cf656d08fe7450c" and "2e7b7313c37e55e64070a3a1f628563c283b5262" have entirely different histories.

5 changed files with 78 additions and 15 deletions

View File

@ -1,15 +1,15 @@
FROM nvidia/cuda:12.5.0-devel-ubi9 as builder
FROM nvidia/cuda:12.4.1-devel-ubi9 as builder
WORKDIR /home/ViolaJones/cpp
COPY *.cu *.cpp *.hpp Makefile ./
RUN make -j "$(nproc)"
FROM nvidia/cuda:12.5.0-base-ubi9
FROM nvidia/cuda:12.4.1-base-ubi9
WORKDIR /home/ViolaJones/cpp
RUN dnf install -y make-1:4.3-8.el9 && dnf clean all
RUN dnf install -y make-1:4.3-7.el9 && dnf clean all
COPY --from=builder /home/ViolaJones/cpp/bin ./bin
COPY --from=builder /home/ViolaJones/cpp/Makefile .

View File

@ -8,7 +8,7 @@ DATA_PATH := ../data
#CFLAGS := -O0 -g -G -pg -Xptxas=-w -Xcompiler -O0,-rdynamic,-g
CFLAGS := -dlto -O2 -Xcompiler -O2
#CFLAGS := -dlto -O2 -g -Xcompiler -O2,-g,-ggdb
CFLAGS := $(CFLAGS) -MMD -MP -Werror=all-warnings -Xcompiler -Wall,-Werror,-Wextra
CFLAGS := $(CFLAGS) -MMD -MP -Werror=all-warnings -Xcompiler -Wall,-Werror,-Werror=implicit-fallthrough=0,-Wextra
EXEC := $(OBJ_DIR)/ViolaJones
DATA := $(DATA_PATH)/X_train.bin $(DATA_PATH)/X_test.bin $(DATA_PATH)/y_train.bin $(DATA_PATH)/y_test.bin
SRC := $(shell find $(SRC_DIR) -name '*.cpp' -o -name '*.cu')
@ -63,7 +63,7 @@ check: $(EXEC) $(DATA) | check-valgrind-works
@valgrind -q -s --leak-check=full --show-leak-kinds=all $(EXEC)
.PHONY: cudacheck
cudacheck: $(EXEC) $(DATA) | check-compute-sanitizer-works
cudacheck: $(EXEC) $(DATA) | check-computer-sanitizer-works
@compute-sanitizer --destroy-on-device-error kernel --tool memcheck --leak-check full --report-api-errors all --track-stream-ordered-races all --target-processes all $(EXEC)
#@compute-sanitizer --destroy-on-device-error kernel --tool racecheck --racecheck-detect-level info --racecheck-report all $(EXEC)
#@compute-sanitizer --destroy-on-device-error kernel --tool initcheck --track-unused-memory yes $(EXEC)
@ -88,7 +88,9 @@ log: $(DATA) reset
.PHONY: reset
reset:
@echo 'Deleting generated states and models'
@rm -frv $(OUT_DIR) $(MODELS_DIR)
@rm -frv $(OUT_DIR)/* $(MODELS_DIR)/*
#@ln -sv /mnt/pierre_stuffs/ViolaJones/cpp/models .
#@ln -sv /mnt/pierre_stuffs/ViolaJones/cpp/out .
.PHONY: clean
clean:
@ -128,8 +130,8 @@ check-dot-works:
check-valgrind-works:
@valgrind --version >/dev/null 2>&1 || (echo 'Please install valgrind.' && exit 1)
.PHONY: check-compute-sanitizer-works
check-compute-sanitizer-works:
@compute-sanitizer --version >/dev/null 2>&1 || (echo 'Please install Compute Sanitizer from Cuda toolkit.' && exit 1)
.PHONY: check-computer-sanitizer-works
check-computer-sanitizer-works:
@computer-sanitizer --version >/dev/null 2>&1 || (echo 'Please install Compute Sanitizer from Cuda toolkit.' && exit 1)
-include $(OBJ:.o=.d)

62
cpp/test.cpp Normal file
View File

@ -0,0 +1,62 @@
#include <iostream>
#include <iomanip>
#include "data.hpp"
#include "toolbox.hpp"
#define PBSTR "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
#define PBWIDTH 60
void printProgress(const float64_t& percentage) noexcept {
const uint64_t val = static_cast<uint64_t>(percentage * 100);
const int32_t lpad = static_cast<int32_t>(percentage * PBWIDTH);
const int32_t rpad = PBWIDTH - lpad;
fprintf(stderr, "%3lu%% [%.*s%*s]\r", val, lpad, PBSTR, rpad, "");
fflush(stderr);
}
void clearProgress(void) noexcept {
// Progress bar width + space before + num space + space after
fprintf(stderr, "%*c\r", PBWIDTH + 1 + 3 + 3, ' ');
}
template<typename T>
void test(const uint64_t& N) noexcept {
#if __DEBUG
printf("DETERMINISTIC for N=%s of %s sized %s\n", thousand_sep(N).c_str(), typeid(T).name(), format_byte_size(sizeof(T)).c_str());
printf("Estimating memory footprint at : %s\n", format_byte_size(3 * N * sizeof(T)).c_str());
#endif
T *a = new T[N], *b = new T[N], *c = new T[N];
T mean = static_cast<T>(0.0);
const size_t percent = N / 100;
for(size_t i = 0; i < N; ++i){
if (i % percent == 0) printProgress(static_cast<float64_t>(i) / N);
a[i] = static_cast<T>(i < N>>1 ? 0.1 : 1.0);
b[i] = static_cast<T>(1.0);
c[i] = a[i] * b[i];
mean += c[i];
}
mean /= static_cast<T>(N);
clearProgress();
std::cout << mean << std::endl;
delete[] a, delete[] b, delete[] c;
}
void test_float(void) noexcept {
std::cout << std::setprecision(1<<8);
const uint64_t N = static_cast<uint64_t>(1)<<28;
test<float128_t>(N);
test<float64_t>(N);
test<float32_t>(N);
//printf("%.128af\n", static_cast<float64_t>(1) / 3);
//std::cout << static_cast<float64_t>(1) / 3 << std::endl;
//std::cout << std::hexfloat << static_cast<float64_t>(1) / 3 << std::endl;
//printf("%.128Lf\n", static_cast<long float64_t>(1) / 3);
//printf("%.128lf\n", static_cast<float64_t>(1) / 3);
//printf("%.128f\n", static_cast<float>(1) / 3);
}

View File

@ -1,6 +1,6 @@
FROM alpine:3.20.0
FROM alpine:3.19.1
RUN apk add --no-cache curl=8.7.1-r0 python3=3.12.3-r1 && rm -rf /var/cache/apk*
RUN apk add --no-cache curl=8.5.0-r0 python3=3.11.9-r0 && rm -rf /var/cache/apk*
WORKDIR /home/ViolaJones/downloader
COPY requirements.txt activate.sh ./

View File

@ -1,8 +1,7 @@
FROM nvidia/cuda:12.5.0-devel-ubi9 as builder
FROM nvidia/cuda:12.4.1-devel-ubi9 as builder
RUN dnf install -y python3.11-3.11.7-1.el9 \
&& dnf clean all \
&& ln -s /usr/bin/python3 /usr/bin/python
RUN dnf install -y python3.11-3.11.5-1.el9_3 && dnf clean all
RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /home/ViolaJones/python
COPY Makefile activate.sh requirements.txt ./