bartoszek / AUR-blender-git

2 stars 2 forks source link

Actual solution for OOM #19

Closed ctrlcctrlv closed 1 year ago

ctrlcctrlv commented 1 year ago

Plan to add this as an envvar to the PKGBUILD.

+ ./blender.slice.sh > ./blender.slice
-  ninja -C "$srcdir/build" ${MAKEFLAGS:--j1}
+  systemd-run --uid=`whoami` --slice=blender.slice -P --working-directory="$PWD" --wait --send-sighup bash -c "ninja -C ""$srcdir/build"
mem_divide_by() {
        (bc <<< "(`cat /proc/meminfo|grep ^MemTotal:|awk '{print $2}'` * 1000) * $1" | head -c -3) || \
                exit 1
}
echo [Service]
echo MemoryMax=$(mem_divide_by 0.9)
echo MemoryHigh=$(mem_divide_by 0.8)
echo CPUQuota=90%

I have 32GB RAM so it's needed.

Control group /:
-.slice
├─blender.slice (#18296)
│ → user.invocation_id: c4820657e973452ea97415c54ae976ce
│ └─run-u3860.service (#19143)
│   → user.invocation_id: e7d7ad654adf4eb1bb44eee4c1072291
│   ├─579655 ninja -C /home/fred/Workspace/aur/blender-git/src/build
│   ├─579663 /usr/bin/c++ -DGFLAGS_DLL_DECL= -DGFLAGS_DLL_DECLARE_FLAG= -DGFLAGS_DLL_DEFINE_FLAG= -DGOOGLE_GLOG_DLL_DECL= -DLIBMV_GFLAGS_NAMESPACE=gflags -DLIBMV_NO_FAST_DETECTOR= -DNDEBUG -D>
│   ├─579664 /usr/bin/c++ -DGFLAGS_DLL_DECL= -DGFLAGS_DLL_DECLARE_FLAG= -DGFLAGS_DLL_DEFINE_FLAG= -DGOOGLE_GLOG_DLL_DECL= -DLIBMV_GFLAGS_NAMESPACE=gflags -DLIBMV_NO_FAST_DETECTOR= -DNDEBUG -D>
│   ├─579665 /usr/bin/c++ -DGFLAGS_DLL_DECL= -DGFLAGS_DLL_DECLARE_FLAG= -DGFLAGS_DLL_DEFINE_FLAG= -DGOOGLE_GLOG_DLL_DECL= -DLIBMV_GFLAGS_NAMESPACE=gflags -DLIBMV_NO_FAST_DETECTOR= -DNDEBUG -D>
│   ├─579673 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/libmv -I /home/fred/Workspace/aur/blender-git/src/blender/extern>
│   ├─579675 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/libmv -I /home/fred/Workspace/aur/blender-git/src/blender/extern>
│   ├─579676 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/libmv -I /home/fred/Workspace/aur/blender-git/src/blender/extern/gflags/src -I /home/fred/Workspace/aur/blender-git/>
│   ├─579678 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/libmv -I /home/fred/Workspace/aur/blender-git/src/blender/extern/gflags/src -I /home/fred/Workspace/aur/blender-git/>
│   ├─579685 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/libmv -I /home/fred/Workspace/aur/blender-git/src/blender/extern>
│   ├─579687 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/libmv -I /home/fred/Workspace/aur/blender-git/src/blender/extern/gflags/src -I /home/fred/Workspace/aur/blender-git/>
│   ├─579776 /usr/bin/c++ -DBOOST_ALL_NO_LIB -DCCL_NAMESPACE_BEGIN=namespace ccl { -DCCL_NAMESPACE_END=} -DCYCLES_GFLAGS_NAMESPACE=gflags -DCYCLES_RUNTIME_OPTIX_ROOT_DIR="" -DGOOGLE_GLOG_DLL_>
│   ├─579777 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/ble>
│   ├─579778 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/hipe>
│   ├─579782 /usr/bin/c++ -DBOOST_ALL_NO_LIB -DCCL_NAMESPACE_BEGIN=namespace ccl { -DCCL_NAMESPACE_END=} -DCYCLES_GFLAGS_NAMESPACE=gflags -DCYCLES_RUNTIME_OPTIX_ROOT_DIR="" -DGOOGLE_GLOG_DLL_>
│   ├─579783 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/ble>
│   ├─579784 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/hipe>
│   ├─579785 /usr/bin/c++ -DBOOST_ALL_NO_LIB -DCCL_NAMESPACE_BEGIN=namespace ccl { -DCCL_NAMESPACE_END=} -DCYCLES_GFLAGS_NAMESPACE=gflags -DCYCLES_RUNTIME_OPTIX_ROOT_DIR="" -DGOOGLE_GLOG_DLL_>
│   ├─579786 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/ble>
│   ├─579787 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/hipe>
│   ├─579788 /usr/bin/c++ -DBOOST_ALL_NO_LIB -DCCL_NAMESPACE_BEGIN=namespace ccl { -DCCL_NAMESPACE_END=} -DCYCLES_GFLAGS_NAMESPACE=gflags -DCYCLES_RUNTIME_OPTIX_ROOT_DIR="" -DGOOGLE_GLOG_DLL_>
│   ├─579789 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/ble>
│   ├─579790 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/hipe>
│   ├─579791 /usr/bin/c++ -DBOOST_ALL_NO_LIB -DCCL_NAMESPACE_BEGIN=namespace ccl { -DCCL_NAMESPACE_END=} -DCYCLES_GFLAGS_NAMESPACE=gflags -DCYCLES_RUNTIME_OPTIX_ROOT_DIR="" -DGOOGLE_GLOG_DLL_>
│   ├─579792 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/ble>
│   ├─579793 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/hipe>
│   ├─579794 /usr/bin/c++ -DBOOST_ALL_NO_LIB -DCCL_NAMESPACE_BEGIN=namespace ccl { -DCCL_NAMESPACE_END=} -DCYCLES_GFLAGS_NAMESPACE=gflags -DCYCLES_RUNTIME_OPTIX_ROOT_DIR="" -DGOOGLE_GLOG_DLL_>
│   ├─579795 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/ble>
│   ├─579796 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/hipe>
│   ├─579797 /usr/bin/c++ -DBOOST_ALL_NO_LIB -DCCL_NAMESPACE_BEGIN=namespace ccl { -DCCL_NAMESPACE_END=} -DCYCLES_GFLAGS_NAMESPACE=gflags -DCYCLES_RUNTIME_OPTIX_ROOT_DIR="" -DGOOGLE_GLOG_DLL_>
│   ├─579798 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/cc1plus -quiet -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/ble>
│   └─579799 as -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/cuew/include -I /home/fred/Workspace/aur/blender-git/src/blender/intern/cycles/../../extern/hipe>
bartoszek commented 1 year ago

Neat trick, but how about using samurai since ninja doesn't seems to care about the issue and samurai has the -m switch from the get go.

ctrlcctrlv commented 1 year ago

I prefer maintaining ninja-mem. Samurai has its own problems :\

Or, perhaps we can do the heretical thing and do -GMakefile to cmake then use a jobserver.

ctrlcctrlv commented 1 year ago

Closed in favor of users just using makepkg-cg if they need it.