gutmann / coarray_icar

Testing implementation of CoArrays for the basic ICAR algorithms
MIT License
5 stars 6 forks source link

Simplify cmake #30

Closed rouson closed 6 years ago

rouson commented 6 years ago

I'm submitting this against master to ensure that the default README.md gets updated. This should also get merged into the develop branch.

gutmann commented 6 years ago

I can get this to compile using cmake, but it crashes with a segphault when it runs. Compiling the same code with the static make file runs fine. I've build a debug compile using cmake and the error is (perhaps not surprisingly) in exchangeable put_north (and put_south). Not knowing cmake, and having the static makefile version run fine, I'm not sure where to begin.

rouson commented 6 years ago

Which compiler and compiler version are you using? Also, please post your cmake command line.

gutmann commented 6 years ago

gfortran 6.3 cmake -DCMAKE_BUILD_TYPE=Debug .. -DCMAKE_INSTALL_PREFIX=./ cmake version 3.10.3

caf version 1.9.1 MPI = mpt 2.15f

gutmann commented 6 years ago

(and built without the debug flag as well)

rouson commented 6 years ago

I'm building GCC 6.3.0 and will let you know if I can reproduce the problem by building with CMake. I'll be testing with the OpenCoarrays master branch (which should be only a few commits ahead of the recent OpenCoarrays 2.0.0 release but many tens of commits ahead of OpenCoarrays 1.9.1).

rouson commented 6 years ago

I built GCC 6.3.0, used that to build MPICH 3.2, CMake 3.10.3, and OpenCoarrays. The test passes for me when I run it at the command line. (I might need to fix something to get it ctest to run it correctly.) My steps were roughly as follows. BTW, this was on a machine in Sameer's lab with the dual Intel Sky Lake processors with 16 cores each and what is apparently much immediate two-way hyperthreading for a total of 72 cores -- cool stuff. :)

git clone https://github.com/sourceryinstitute/opencoarrays
cd opencoarrays

# Install GCC 6.3.0
./install.sh -p gcc -I 6.3.0 -j 8 -y -z -i $HOME/opt/gnu/6.3.0
export PATH=$HOME/opt/gnu/6.3.0/bin:$PATH
export LD_LIBRARY_PATH=$HOME/opt/gnu/6.3.0/lib64:$LD_LIBRARY_PATH

# Install MPICH
./install.sh -p mpich -j 8 -y -i $HOME/opt/mpich/3.2/gnu/6.3.0
export PATH=$HOME/opt/mpich/3.2/gnu/6.3.0/bin:$PATH

# Install CMake
./install.sh -p cmake -I 3.10.3 -j 16 -y -i $HOME/opt/cmake/3.10.3
export PATH=$HOME/opt/cmake/3.10.3/bin:$PATH

# Install OpenCoarrays
./install.sh -j 8 -y -i $HOME/opt/opencoarrays/2.0.0/gnu/6.3.0

source $HOME/opt/opencoarrays/2.0.0/gnu/6.3.0/setup.sh
cd ../coarray_icar/
mkdir build
cd build
FC=caf cmake ..
make -j 8
cd src/tests/
cp ~/input-parameters.txt ~/*.dat .
cafrun -n 16 ./test-ideal

Number of images =           16
           1 domain%initialize_from_file('input-parameters.txt')
 ximgs=           4 yimgs=           4
 call master_initialize(this)
 call this%variable%initialize(this%get_grid_dimensions(),variable_test_val)
  Layer height       Pressure        Temperature      Water Vapor
      [m]              [hPa]             [K]            [kg/kg]
   9750.00000       271.047180       206.509430       9.17085254E-06
   7750.00000       364.236786       224.725372       7.91714992E-05
   5750.00000       481.825287       243.449936       5.01311326E-04
   3750.00000       628.424316       262.669800       2.46796501E-03
   1750.00000       809.217651       282.372711       9.08217765E-03
 ThompMP: read qr_acr_qg.dat instead of computing
 qr_acr_qg initialized:  0.118000001            
 ThompMP: read qr_acr_qs.dat instead of computing
 qr_acr_qs initialized:   6.40000030E-02        
 ThompMP: read freezeH2O.dat instead of computing
 freezeH2O initialized:  0.527000010            
 qi_aut_qs initialized:   1.09999999E-02        

 Beginning simulation...
 Model run time:  41.172 seconds         
           5  :    0.00000000       0.00000000       0.00000000       0.00000000       0.00000000       0.00000000       0.00000000       0.00000000       0.00000000       0.00000000       1.95229131E-06   2.89194122E-05   1.41856479E-04   4.68750542E-04   1.25238195E-03   2.92633707E-03   6.23118645E-03   1.23989917E-02   2.34347358E-02   4.25490625E-02   7.46941566E-02  0.127624929      0.212657690      0.345939010      0.548513353    
           6  :   0.647401989      0.986020565       1.49600804       2.17739129       3.00542474       3.91794038       4.83113623       5.66033077       6.35462713       6.89002895       7.27593946       7.53007269       7.67451239       7.73031664       7.71289444       7.63897800       7.51750898       7.35810852       7.16916037       6.95673323       6.72172451       6.47190046       6.20951176       5.93305492       5.64848471       5.26346588    
           7  :    5.40883207       5.15659285       4.87437487       4.58606291       4.30022335       4.02136374       3.75163198       3.49380779       3.24867964       3.01747656       2.79894590       2.59183002       2.39505601       2.20778060       2.02955222       1.86019444       1.69949102       1.54808402       1.41376448       1.30255067       1.19916689       1.08934021      0.973329246      0.858228505      0.750450134      0.625719368    
           8  :   0.659700334      0.569530964      0.485505432      0.411378384      0.346413314      0.289588183      0.240191236      0.197659224      0.161369920      0.130625799      0.104831755       8.34211484E-02   6.58131167E-02   5.14358543E-02   3.97929884E-02   3.04525625E-02   2.30396632E-02   1.72179528E-02   1.26971211E-02   9.23144631E-03   6.60924846E-03   4.65827109E-03   3.22989793E-03   2.20270222E-03   0.00000000    
 Test passed.
rouson commented 6 years ago

Apparently ctest works too. I'm not sure why it appeared to me for a moment that it doesn't. So I suspect that if you're seeing problems, it might be an issue related to the environment. Most often for me, problems relate to my forgetting to set or incorrectly setting my PATH or LD_LIBRARY_PATH variables as detailed above. FYI, the commands in my last comment were a mix of typing from memory and copying and pasting. Hopefully I got all the details right.

rouson commented 6 years ago

I also just used the steps outlined above to build and test with GCC 6.4.0 and the test passes. I ran it with ctest --verbose after copying the *.dat files into the top-level build directory.

gutmann commented 6 years ago

since this is merged and the other is closed, I'm going to open an issue to track this