[petsc-users] Regarding Valgrind

Jacob Faibussowitsch jacob.fai at gmail.com
Tue May 5 09:53:37 CDT 2020


Using Docker is certainly the easiest way to do this in my experience! You can install docker desktop here https://hub.docker.com/editions/community/docker-ce-desktop-mac/ <https://hub.docker.com/editions/community/docker-ce-desktop-mac/>

Then make a docker context file (preferably in an empty directory somewhere) with the following contents:

FROM jedbrown/mpich-ccache                                                                           
USER root

# PACKAGE INSTALL                                                                                    
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get -y install build-essential
RUN apt-get -y install python3

# OPTIONAL
RUN apt-get -y install libc6-dbg

# VALGRIND  BUILD FROM SOURCE                                                                                         
WORKDIR /
RUN git clone git://sourceware.org/git/valgrind.git
WORKDIR /valgrind
RUN git pull
RUN ./autogen.sh
RUN ./configure --with-mpicc=/usr/local/bin/mpicc
RUN make -j 5
RUN make install

# ENV VARIABLES                                                                                      
ENV PETSC_DIR="/petsc"
ENV PETSC_ARCH="arch-linux-c-debug”
RUN echo 'export PATH="/usr/lib/ccache:$PATH"' >>  ~/.bashrc

RUN "/usr/sbin/update-ccache-symlinks"
WORKDIR /petsc

Then simply run these commands from command line:

docker build -t valgrinddocker:latest /PATH/TO/DOCKER/FILE
docker run -it --rm --cpus 4 -v ${PETSC_DIR}:/petsc:delegated valgrinddocker:latest’

This will build and launch docker image called “valgrinddocker” based on ubuntu with mpi and ccache preinstalled as well as optionally build valgrind from source. It also most importantly mounts your current ${PETSC_DIR} inside the container meaning you don’t have to reinstall PETSc inside docker. Anything you do inside the docker will also be mirrored on your “local” machine inside ${PETSC_DIR}. You will have to have a separate arch folder for running inside the image however so you will have to go through ./configure again.

Alternatively If you don’t want to build valgrind from source and instead use apt-get to install it you may remove the commands regarding building valgrind and installing libc6-dbg.

Hope this helps!

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
Cell: (312) 694-3391

> On May 5, 2020, at 7:46 AM, MUKKUND SUNJII <mukkundsunjii at gmail.com> wrote:
> 
> Greetings, 
> 
> I have been working on modifying ex11.c by adding source terms to the existing model. 
> 
> In the process, I had introduced some memory corruption errors. The modifications are fairly large, hence it is difficult to single out the problem. 
> 
> In the FAQ page, I saw that we can use the flag -malloc_debug and/or CHKMEMQ statements. However, they don’t seem to help my case. 
> 
> At this point of time, Valgrind is not supported by MAC OS X as I have the newer version of the OS. Any suggestions on how to figure out the source of the problem?
> 
> Regards, 
> 
> Mukkund

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200505/70831a8f/attachment-0001.html>


More information about the petsc-users mailing list