# CAEToR issues related MPI

**URL:** https://castor-project.discourse.group/t/caetor-issues-related-mpi/386
**Category:** General Discussions
**Tags:** pet
**Created:** [August 3, 2022, 3:54am UTC](https://castor-project.discourse.group/t/caetor-issues-related-mpi/386 "2022-08-03T03:54:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![JoaoWang](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@JoaoWang](https://castor-project.discourse.group/u/JoaoWang)
#### Post date: [August 3, 2022, 3:54am UTC](https://castor-project.discourse.group/t/caetor-issues-related-mpi/386/1 "2022-08-03T03:54:37Z")

</div>

I have compiled and installed CASToR software on my computer (OS: Ubuntu 20.04 LTS) using the provided Makefile according to the relevant instructions in Section III of General Documentation. During compilation, I set the values of environment variables CASTOR\_MPI and CASTOR\_OMP related to MPI to 1, and MPICH 3.3.2 and openMPI 4.1.4 are also installed on my computer. Although I successfully installed CASToR software, when I used the following commands to reconstruct an PET image, I found that the time consumed by castor-recon (installed by myself) was much longer than the castor-recon\_ unix64 (binary executable provided by official)。

_\>\> castor-recon -df XXX\_df.Cdh -opti MLEM -it 10:16 -proj joseph -conv gaussian,4.,4.5,3.5::psf -dim 128,128,64 -vox 3.2,3.2,4.3 -dout recon\_img\_1_

_\>\> castor-recon\_unix64 -df XXX\_df.Cdh -opti MLEM -it 10:16 -proj joseph -conv gaussian,4.,4.5,3.5::psf -dim 128,128,64 -vox 3.2,3.2,4.3 -dout recon\_img\_1_

For example, for sensitivity generation, castor-recon takes 13659 seconds, while castor-recon\_unix64 takes only 5333 seconds.

I’m very suspicious that MPI is not used when executing castor-recon program. Where should I explicitly specify to enable MPI? Or, did I make any mistakes when compiling?

Here are the commands I entered at compile time:

_\>\> export CASTOR\_CONFIG=/home/vgate/Software/CASToR\_v3.1.1/config_

_\>\> export CASTOR\_MPI=1_

_\>\> export CASTOR\_OMP=1_

_\>\> export CASTOR\_ROOT=1_

_\>\> export CASTOR\_SIMD=1_

_\>\> export CASTOR\_VERBOSE=1_

_\>\> export CASTOR\_DEBUG=1_

_\>\> make -j24_

I sincerely look forward to your reply！

---

<div class="post-metadata">

### Author: ![tmerlin](https://yyz2.discourse-cdn.com/free1/user_avatar/castor-project.discourse.group/tmerlin/32/216_2.png) [@tmerlin](https://castor-project.discourse.group/u/tmerlin)
#### Post date: [August 19, 2022, 8:33pm UTC](https://castor-project.discourse.group/t/caetor-issues-related-mpi/386/2 "2022-08-19T20:33:11Z")

</div>

Hi Joao,  
Indeed it looks like MPI does not behave properly. Do you also see a difference for the reconstruction part or is it only for the sensitivity image generation ? Additionally do you have dynamic or static data ?  
MPI was implemented a while ago and we don’t test it very often, so I will check next week if I get the same issue with the current version, and come back to you.

---

<div class="post-metadata">

### Author: ![JoaoWang](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@JoaoWang](https://castor-project.discourse.group/u/JoaoWang)
#### Post date: [August 20, 2022, 12:32pm UTC](https://castor-project.discourse.group/t/caetor-issues-related-mpi/386/3 "2022-08-20T12:32:19Z")

</div>

Hi Tmerlin,

When I compiled CASToR with Makefile, I encountered MPI problem, but later I compiled with CMake, everything was fine. So, I guess this problem may be related to the Makefile.

Best Regard!  
Joao Wang

---

<div class="post-metadata">

### Author: ![sstute](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sstute](https://castor-project.discourse.group/u/sstute)
#### Post date: [September 5, 2022, 9:27am UTC](https://castor-project.discourse.group/t/caetor-issues-related-mpi/386/4 "2022-09-05T09:27:12Z")

</div>

Hi,

The precompiled binaries do not include CASTOR\_VERBOSE, CASTOR\_DEBUG, CASTOR\_SIMD nor CASTOR\_MPI.

When you compiled with the Makefile, you enabled CASTOR\_VERBOSE, CASTOR\_DEBUG and CASTOR\_SIMD. You should not enable these variables unless you really need them.

It is likely that the slow behaviour came from DEBUG and VERBOSE.

When you compiled with CMake, did you enable these features while in the CMake menu ?

The probability that the problem came from MPI is close to zero as there is no difference at all with what should happen when using either Makefile or CMake.

That being said, MPI is not enabled in the precompiled binary because its use is quite specific. Do you really need it ? If no, then you should not enable it.

All the best

Simon
