Skip to content

Commit d4fba33

Browse files
committed
Fix test for GPU+CPU
1 parent 8a67662 commit d4fba33

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

opt/build/onnxruntime/Dockerfile.x64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN apt-get install -y locales && \
2424

2525
WORKDIR /build
2626

27-
ARG BUILDTYPE=Debug
27+
ARG BUILDTYPE=MinSizeRel
2828

2929
ARG BUILDARGS="--config ${BUILDTYPE} --parallel"
3030

opt/build/onnxruntime/Dockerfile.x64-gpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ RUN ./build.sh ${BUILDARGS} --update --build --use_cuda --cudnn_home /usr/local/
4040

4141
ADD ./pack.sh /build/
4242
WORKDIR /build
43-
RUN /pack.sh ${ONNXRUNTIME_VER} ${ARCH}
43+
RUN ./pack.sh ${ONNXRUNTIME_VER} ${ARCH}

opt/build/onnxruntime/pack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VER="$1"
55
PLATFORM="$2"
66

77
mkdir -p pack/include pack/lib
8-
cp onnxruntime/build/Linux/Debug/libonnxruntime.so.${VER} pack/lib/
8+
cp onnxruntime/build/Linux/MinSizeRel/libonnxruntime.so.${VER} pack/lib/
99
cp onnxruntime/docs/C_API_Guidelines.md pack/
1010
cp onnxruntime/LICENSE pack/
1111
cp onnxruntime/README.md pack/

src/backends/onnxruntime.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const OrtMemoryInfo *AllocatorInfo(const OrtAllocator *allocator) {
3232
return mem_info;
3333
}
3434

35+
// Allocate address with 64-byte alignment to cope with onnx optimizations.
3536
void *AllocatorAlloc(OrtAllocator *ptr, size_t size) {
3637

3738
(void)ptr;
@@ -47,8 +48,9 @@ void *AllocatorAlloc(OrtAllocator *ptr, size_t size) {
4748

4849
void AllocatorFree(OrtAllocator *ptr, void *p) {
4950
(void)ptr;
50-
if (p == NULL)
51+
if (p == NULL) {
5152
return;
53+
}
5254
void *p1 = ((void **)p)[-1];
5355
size_t allocated_size = RedisModule_MallocSize(p1);
5456
atomic_fetch_sub(&OnnxMemory, allocated_size);

tests/flow/tests_onnx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,5 +538,5 @@ def test_onnx_use_custom_allocator_with_GPU(env):
538538
ai_memory_config = {k.split(":")[0]: k.split(":")[1]
539539
for k in con.execute_command("INFO MODULES").decode().split("#")[4].split()[1:]}
540540
env.assertTrue(int(ai_memory_config["ai_onnxruntime_memory"]) > 100)
541-
env.assertTrue(int(ai_memory_config["ai_onnxruntime_memory"]) < 400)
541+
env.assertTrue(int(ai_memory_config["ai_onnxruntime_memory"]) < 705)
542542
env.assertEqual(int(ai_memory_config["ai_onnxruntime_memory_access_num"]), 5)

0 commit comments

Comments
 (0)