sourceryinstitute / OpenCoarrays

A parallel application binary interface for Fortran 2018 compilers.
http://www.opencoarrays.org
BSD 3-Clause "New" or "Revised" License
246 stars 56 forks source link

Question: Configuring install.sh to see prereqs #530

Closed jordana309 closed 6 years ago

jordana309 commented 6 years ago

Question

Question: Configuring install.sh to see prereqs

Observed Behavior

After downloading prerequisites that I have installed on my system, install.sh crashed out trying to compile gcc-7.3.0, it appears. The output is attached. I should note that I am new to playing with compilers, so my mistake is probably silly and easily corrected, but I need some help understanding what that is. How would I configure the install.sh script to see my installed prerequisites?

Expected Behavior

Completing the install, and recognizing the preinstalled prerequisites. I do expect, however, to have to point the install script to my install of MPICH 3.2, but I'm not sure how.

Steps to Reproduce

Type the following into your terminal:

sudo apt-get install aptitude
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo aptitude install gcc-7 g++-7 gfortran-7
cd ~/Codes/src
git clone https://github.com/sourceryinstitute/OpenCoarrays.git
cd OpenCoarrays
bash install.sh

After it gets to installing gcc-7, it will crash out like this.

OUTPUT after error is attaches (it was longer than expected). Compile Error.txt

rouson commented 6 years ago

See example 3 in the Example script invocations in the INSTALL.md file. In addition, I recommend adding the --disable-bootstrap or equivalently the -z argument to speed up the build process considerably (but try again without these arguments if the build fails. Also, I recommend speeding things up further with a parallel build. For example, on a system with 4 cores, use --num-threads 4 or equivalently -j 4. So please try something like the following:

./install.sh 
   --with-fortran <path-to-gcc-bin>/gfortran \
   --with-cxx <path-to-gcc-bin>/g++ \
   --with-c <path-to-gcc-bin>/gcc \
   --disable-bootstrap \
   --num-threads 4 \
   --install-prefix <path-to-desired-opencoarrays-location> 

where <path-go-gcc-bin>\ may be ommitted if the desired gcc/g++/gfortran are at the front of your $PATH.

zbeekman commented 6 years ago

@jordana309 If you already have gcc-7, g++-7 and gfortran-7 installed at the front of your path then just specify them to install.sh

Confirm that GCC-7 compilers are on your path:

which gcc-7
which g++-7
which gfortran-7

Each command should print the location of the compiler.

Next, try:

./install.sh \
   --with-fortran "`which gfortran-7`"
   --with-cxx "`which g++-7`"
   --with-c "`which gcc-7`"
   -j 4
   --install-prefix "/path/to/install/OpenCoarrays/into"

If you have CMake and MPI installed too, you might just want to install directly with CMake.

jordana309 commented 6 years ago

I got Fortran to install by running the following line (I had to manually put in all my paths, and specifically install mpich for some reason: bash install.sh --with-fortran "/usr/bin/gfortran-7" --with-cxx "/usr/bin/g++-7" --with-c "/usr/bin/gcc-7" --disable-bootstrap --num-threads 4 --package mpich --install-prefix "<specific path>"

Thank you for your help. Then, I installed the Jupyter CAF kernel, and when I ran the kernel in jupyter, it connected fine. However, when trying to run a simple hello world program to make sure it works, I got the following error:

  File "/home/jordan/Codes/Anaconda/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'caf': 'caf'

Is that likely a kernel problem, or a Coarrays Fortran problem? I'm not sure how to overcome it, because the actual kernelspec file looks fine from what I can tell.

Thank you!

zbeekman commented 6 years ago

hmmmm I'm not sure. Jupyter CAF kernel has been neglected for a few months. If you type which caf does it show you where you installed OpenCoarrays? If you set the --install-prefix to something that is not on your PATH by default you will have to make sure it gets added, probably somewhere in your "dot files". I'm not 100% sure how python & Jupyter handle the user's PATH in the context of Jupyter kernels.

jordana309 commented 6 years ago

which caf returns nothing, and when I tried to add the from my --install-prefix, it still can't find it. I tried doing the bin folder in that directory, but no dice. I tried to point to the caf kernel and several folders in there, but it didn't like any of them (and I did remember to close all my terminals and reopen them between tests). What is 'caf' supposed to be pointing to? MPICH? the CAF kernel?

jordana309 commented 6 years ago

K, I've progressed, I think. I had a customized mpich from a different program on PATH, and I didn't follow the instructions at the end of the install:

# Execute this script via the following command:                                
# source /home/jordan/Codes/coarrayfortran/setup.sh                                             

# Prepend the CMake path to the PATH environment variable:
# Prepend the compiler path to the PATH environment variable:
# Prepend the compiler library paths to the LD_LIBRARY_PATH environment variable:
# Prepend the MPI path to the PATH environment variable:
# Prepend the OpenCoarrays path to the PATH environment variable:
*** To set up your environment for using caf and cafrun, please source the installed setup.sh file in a bash shell or source setup.csh in a C-shell or add one of the following statements to your login file:                                           ***

 source /home/jordan/Codes/coarrayfortran/setup.sh
 source /home/jordan/Codes/coarrayfortran/setup.csh

I have now started with a clean Ubuntu image without this other program, and installed. No problems with installation this time. CMake and the compilers are in PATH already because I installed them with apt-get (though I have gfortran and gfortran-7...I built with gfortran-7, but I'm not sure it will use that when called), I'm not sure what to do about the compiler libraries, I added MPICH and OpenCoarrays to my PATH:

export PATH=<...>/OpenCoarrays/prerequisites/installations/mpich/3.2/bin:$PATH:<install dir>/bin
source <install dir>/setup.sh

All of that worked fine. But when I tried to install the CAF kernel, I got this:

pip install -e prebuild/jupyter-caf-kernel
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main

Thoughts on the compiler libraries or this error?

jordana309 commented 6 years ago

K, for some reason I needed to source activate base to use the right pip. My system pip has been broken by something. My base anaconda pip ran just fine, and installed. I did notice, however, that it ran my code twice:

program hello
   print *, "Hello World?"
end program hello

returns

Hello World?
Hello World?

Thoughts about why?

zbeekman commented 6 years ago

Yes, there is a default of two coarray images. You can use some magic to control compilation and number of images. Let's close this issue and open one on Jupyter-CAF-kernel to continue discussion there.

zbeekman commented 6 years ago

See, e.g., https://github.com/sourceryinstitute/jupyter-CAF-kernel/blob/master/index.ipynb. This should load as a non-interactive example notebook. You can see in the first input cell two "magics" one to say how many images to use %num_images: 1 and one to allow longer input lines: %fc_flags: -ffree-line-length-none. It looks like GH is having trouble rendering the entire document for me, so you can also look at it here: https://nbviewer.jupyter.org/github/sourceryinstitute/jupyter-CAF-kernel/blob/master/index.ipynb

rouson commented 6 years ago

Shall we close the issue?

jordana309 commented 6 years ago

Yeah, lets close this one. Thank you!