I had Calculix 2.20 with Pastix compiled and running on Ubuntu 20.04 + CUDA 11.1 at one point. However, this time it was like pulling teeth trying to compile the stock code of Calculix 2.22 and Pastix (along with CUDA 12.6, parsec, scotch, openblas etc) on Ubuntu 24.04.
Finally, after all the stars lined up, I was able to compile ccx, but no luck running the executable ccx on simple model file (beamp.inp). I would really appreciate if someone can look at the snip from the run and help me identify the main culprit here or what I could try diagnosing. It seems the ccx solver starts but crashes when it calls Pastix. The executable works fine and goes to completion with spooles and paradiso.
I am trying to journal my findings and make files just in case it helps someone else. Please understand the file paths for the libraries may be different in each system, please check them before you use them.
Here is my make_parsec.sh file:
#!/bin/bash
if ! [[ -d build ]]; then
mkdir build
fi
cd build
INSTALLPATH="/usr/local/PaStiX/parsec_i8"
umask 022
# fixes
sed -i '/-1 == cpu/i return cpu;' parsec/bindthread.c
cmake \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${INSTALLPATH} \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-12.6 \
-DCUDA_DIR=/usr/local/cuda-12.6 \
-DCUDA_USE_STATIC_CUDA_RUNTIME=ON \
-DCMAKE_CUDA_HOST_COMPILER=gcc \
-DPARSEC_GPU_WITH_CUDA=ON \
-DHWLOC_DIR=/usr/local/PaStiX/hwloc_i8 \
..
make -j8
rm -rf ${INSTALLPATH}
make install
Here is my make_pastix.sh file:
#!/bin/bash
if ! [[ -d build ]]; then
mkdir build
fi
cd build
INSTALLPATH="/usr/local/PaStiX/pastix_i8"
#CUDADIR="/usr/lib/cuda"
PARSECDIR="/usr/local/PaStiX/parsec_i8"
SCOTCHDIR="/usr/local/PaStiX/scotch_i8"
HWLOCDIR="/usr/local/PaStiX/hwloc_i8"
BLASDIR="/usr/local/PaStiX/OpenBLAS_i8"
cmake \
-DBLAS_DIR=/usr/local/OpenBLAS_i8 \
-DHwloc_DIR=/usr/local/PaStiX/hwloc_i8 \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-12.6 \
-DCUDA_DIR=/usr/local/cuda-12.6 \
-DCMAKE_INSTALL_PREFIX=/usr/local/PaStiX/pastix_i8 \
-DCMAKE_BUILD_TYPE=Release \
-DPASTIX_WITH_PARSEC=ON \
-DPASTIX_WITH_CUDA=ON \
-DPASTIX_INT64=ON \
-DPARSEC_DIR=/usr/local/PaStiX/parsec_i8 \
-DTHREADS_PREFER_PTHREAD_FLAG=ON \
-DCMAKE_C_FLAGS="-fopenmp" \
-DCMAKE_EXE_LINKER_FLAGS="-L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi -pthread" \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_CXX_COMPILER=mpicxx \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_THREAD_LIBS_INIT="-lpthread" \
-DCMAKE_USE_PTHREADS_INIT=TRUE \
-DCMAKE_C_FLAGS="-fopenmp" \
-DMPI_INCLUDE_DIRS=/usr/lib/x86_64-linux-gnu/openmpi/include \
-DMPI_LIBRARIES=/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so \
-DMPI_EXECUTABLE=/usr/bin/mpiexec \
-DMPI_C_COMPILER=/usr/bin/mpicc \
-DPASTIX_WITH_MPI=ON \
-DSCOTCH_DIR=/usr/local/PaStiX/scotch_i8 \
..
make -j8
make install
And here is the Makefile_i8 file that I used to compile ccx:
CFLAGS = -Wall -O2 -fopenmp -fpic -I ../../../SPOOLES.2.2 -I$(PASTIX_INCLUDE) -DARCH="Linux" -DSPOOLES -DARPACK -DMATRIXSTORAGE -DINTSIZE64 -DPASTIX -DPASTIX_FP32 -DPASTIX_GPU
FFLAGS = -Wall -O2 -fopenmp -fpic -fdefault-integer-8
CC=cc
FC=gfortran
.c.o :
$(CC) $(CFLAGS) -c $<
.f.o :
$(FC) $(FFLAGS) -c $<
include Makefile.inc
SCCXMAIN = ccx_2.22.c
OCCXF = $(SCCXF:.f=.o)
OCCXC = $(SCCXC:.c=.o)
OCCXMAIN = $(SCCXMAIN:.c=.o)
DIR=../../../SPOOLES.2.2
PASTIX_INCLUDE = ../../../PaStiX/pastix_i8/include
PASTIX_LIBS = ../../../PaStiX/hwloc_i8/lib/libhwloc.so \
../../../OpenBLAS_i8/lib/libopenblas.a \
../../../PaStiX/pastix_i8/lib/libpastix.a ../../../OpenBLAS_i8/lib/libopenblas.a -lpthread -lm ../../../PaStiX/pastix_i8/lib/libspm.a \
../../../PaStiX/pastix_i8/lib/libpastix_parsec.a ../../../PaStiX/pastix_i8/lib/libpastix_kernels.a ../../../OpenBLAS_i8/lib/libopenblas.a -lrt \
../../../PaStiX/pastix_i8/lib/libpastix_kernels_cuda.a ../../../PaStiX/parsec_i8/lib/libparsec.so \
../../../PaStiX/scotch_i8/lib/libscotch.a ../../../PaStiX/scotch_i8/lib/libscotcherrexit.a -lpthread -lz -lm /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libgomp.so.1 -lhwloc -lmpi -lmpi_cxx \
-lpthread -ldl -lrt \
/usr/local/cuda-12.6/lib64/libcudart_static.a \
/usr/lib/x86_64-linux-gnu/libcublas_static.a \
/usr/local/cuda-12.6/lib64/libculibos.a \
/usr/lib/x86_64-linux-gnu/libcublasLt_static.a \
/usr/lib/x86_64-linux-gnu/libcuda.so \
LIBS = \
$(DIR)/spooles.a \
../../../ARPACK_i8/libarpack_INTEL_i8.a \
$(PASTIX_LIBS) \
-lpthread -lm -lc
ccx_2.22_i8: $(OCCXMAIN) ccx_2.22.a $(LIBS)
./date.pl; $(CC) $(CFLAGS) -c ccx_2.22.c; $(FC) -Wall -O2 -o $@ \
$(OCCXMAIN) ccx_2.22.a $(LIBS)
ccx_2.22.a: $(OCCXF) $(OCCXC)
ar vr $@ $?