[petsc-users] [RFC] Docs: TeX -> HTML

2016-07-23 Thread Marco Zocca
Dear all,

  following the discussion at PETSc'16, I have tried to render the
TeX-based manual into HTML with latex2html [1] and pandoc [2] .

Neither attempt was successful, because of the presence of certain
external TeX packages used for rendering various custom aspects of the
manual.

There is no 1:1 way of converting such a document. However there are a
number of templates for rendering static websites that use LaTeX math
and verbatim source code (e.g. readthedocs [3] for manual-type
documents, which also supports MathJax [4] and re-renders at every
repository push).

At any rate, the conversion requires copying blocks of text and code
to the web-based version, i.e. removing all the LaTeX markup,
therefore effectively committing to maintaining 2 versions of the
manual up to date and in sync with each other.


Before committing to any approach, I would like your input on this:

1) Do you have any preference for web rendering/site hosting solution?

2) Are you OK with the idea of essentially forking the manual into PDF
output and web output ? It is not huge work (an afternoon of tweaking
initially and a couple minutes at every new release) but we should be
sure about the approach in the first place.

Any and all feedback is welcome;

Thank you and kind regards,
Marco


[1] https://www.ctan.org/tex-archive/support/latex2html/
[2] http://pandoc.org/
[3] https://readthedocs.org/
[4] http://mathjax.readthedocs.io/en/latest/tex.html


Re: [petsc-users] HDF5 and PETSc

2016-07-11 Thread Marco Zocca
Sorry for the previous mail, I hadn't fully read  ./configure --help :
all external package options are listed there, including HDF5

As far as I can see in
https://www.mcs.anl.gov/petsc/miscellaneous/external.html and on the
PDF manual, not all external packages are mentioned, and this tripped
me initially.

So my question becomes: please synchronize the output of ./configure
--help with manpages and pdf manual :)

Thanks again,
Marco


On 11 July 2016 at 09:57, Marco Zocca <zocca.ma...@gmail.com> wrote:
> Good morning,
>
>Does the HDF5 functionality need to be explicitly requested at
> configure time? I just noticed that my default configuration on a
> single-node machine does not compile any relevant symbol.
>
> I do not have HDF5 installed on my system yet, but I assumed PETSc
> includes it by default, or automagically pulls the dependency in at
> config time, since the manual doesn't mention anything about it. Do I
> have to install HDF5 from source and rebuild PETSc then?
>
> Thanks in advance,
> Marco
>
>
>
> --- config options and architecture :
>
> Configure Options: --configModules=PETSc.Configure
> --optionsModule=config.compilerOptions --with-cc=gcc --with-cxx=g++
> --with-fc=gfortran --download-fblaslapack --download-mpich
> Working directory: /Users/ocramz/petsc-3.7.2
> Machine platform:
> ('Darwin', 'fermi.local', '13.4.0', 'Darwin Kernel Version 13.4.0: Sun
> Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64',
> 'x86_64', 'i386')
> Python version:
> 2.7.5 (default, Mar  9 2014, 22:15:05)
> [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]


[petsc-users] Re. PETSc user meeting 2016

2016-07-02 Thread Marco Zocca
Dear colleagues near and far,

  it has been a pleasure to meet you all in person during this very
interesting and lively meeting. I have learned much about branches of
science I had not previously considered and the current state of HPC,
and for this I would like to thank all of the speakers and poster
presenters, but first and foremost the PETSc team, the sponsors and
our excellent host Karl.

Hoping to meet you soon again, perhaps at PETSc'17,
Kind regards,

Marco Zocca



https://github.com/ocramz/petsc-hs
https://github.com/ocramz/petsc-hs-docker


[petsc-users] re. AIJ preallocation man page

2016-05-23 Thread Marco Zocca
Dear all,

I'm struggling with this statement:

"It is recommended that you call both of the above preallocation
routines [MatSeqAIJSetPreallocation and MatMPIAIJSetPreallocation] for
simplicity."

(source: 
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATAIJ.html
)

I saw that, even on a single-processor communicator,
MatMPIAIJSetPreallocation works fine (at least, it gives no errors,
but I don't know about efficiency drops).
What's the effect of the recommended double preallocation?

Thank you and KR,
Marco


[petsc-users] petsc 3.7 and slepc 3.6.1 incompatibility

2016-04-27 Thread Marco Zocca
Dear All,

  first, let me congratulate and thank the PETSc team and all
contributors for release 3.7 .

I just noticed that the changes in Options handling introduced in 3.7
broke the build of the latest SLEPc (3.6.1, since 3.6.3 is flagged as
incompatible with 3.7).

Is there already a time estimate for a compatible release of SLEPc ?

Thank you and kind regards,

Marco Zocca


Re: [petsc-users] installation on cloud platform

2016-01-04 Thread Marco Zocca
Hello Tabrez,

  thank you for the walkthrough; I'll give it a try as soon as possible.

My main doubt was indeed regarding the host resolution and security;

what does the special hostfile line do? What about that "ip-x-x-x-x"
construct?

Thank you and kindest regards,

Marco




>
> Or you can install everything yourself.
>
> On vanilla Debian based AMIs (e.g., Ubuntu 14.04 LTS) just make sure to
> add "127.0.1.1 ip-x-x-x-x" to your /etc/hosts followed by
>
> $ cd
> $ ssh-keygen -t rsa
> $ cat .ssh/id_rsa.pub  >> .ssh/authorized_keys
>
> After that the usual stuff, e.g.,
>
> $ sudo apt-get update
> $ sudo apt-get upgrade
> $ sudo apt-get install gcc gfortran g++ cmake wget
> $ wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.6.3.tar.gz
> $ ./configure --with-cc=gcc --with-fc=gfortran --download-mpich
> --download-fblaslapack --with-metis=1 --download-metis=1 --with-debugging=0
> $ export PETSC_DIR=/home/ubuntu/petsc-3.6.3
> $ export PETSC_ARCH=arch-linux2-c-opt
> $ make all
> $ export PATH=$PATH:$PETSC_DIR/$PETSC_ARCH/bin
>
> Tabrez
>
>
> On 01/03/2016 07:07 AM, Matthew Knepley wrote:
>> On Sun, Jan 3, 2016 at 5:59 AM, Marco Zocca <zocca.ma...@gmail.com
>> <mailto:zocca.ma...@gmail.com>> wrote:
>>
>> Dear all,
>>
>>   has anyone here tried/managed to install PETSc on e.g. Amazon AWS or
>> the Google Compute Engine?
>>
>> I believe some extra components are needed for coordination, e.g.
>> Kubernetes or Mesos (in turn requiring that the library be compiled
>> within some sort of container, e.g. Docker), but I'm a bit lost amid
>> all the options.
>>

>>


Re: [petsc-users] installation on cloud platform

2016-01-04 Thread Marco Zocca
Hi Satish,

 thank you for the input;

I was really looking for something that lets one abstract out "where"
the code lives, so as to possibly work both in a single-node and
cluster setting.

This is why a "container" approach sounds meaningful. Configure once, run many.
For message-passing codes such as our case, there's this
`docker-compose` [ https://docs.docker.com/compose ] which aggregates
the compilation and network setup steps.
I have found this approach [
http://qnib.org/2015/04/14/qnibterminal-mpi-hello-world/ ] that runs
an MPI benchmark using `docker-compose`. The "Consul" library takes
care of the DNS resolution as far as I can tell, and SLURM is the
queue manager.

The downsides: it's yet another third party tool (albeit a widespread
one), with yet another scripting syntax (very much similar but
incompatible with shell script).
Latencies will be much larger, I expect, and also one should pay a
much higher attention to security (building on top of someone else's
images, freely available from the Docker Hub, is tantamount to running
arbitrary code at compile time).

There are however trusted Docker images, containing various
combinations of Linux distributions and software.

I'm very much looking forward to continuing this discussion;

Kind regards,

Marco



> Are you interested in using 1 node [with multiple cores] - or multiple
> nodes - aka cluster on amazon?
>
> For a single node - I don't think any additional config should be
> necesary [/etc/hosts - or ssh keys]. It should be same as any laptop
> config.
>
> Its possible that 'hostname' is not setup properly on amazon nodes - and
> MPICH misbehaves.  In this case - you might need any entry to
> /etc/hosts. Perhaps something like:
>
> echo 127.0.0.1 `hostname` >> /etc/hosts
>
> If cluster - then there might be a tutorial to setup a proper cluster with 
> AWS. Googles gives
> http://cs.smith.edu/dftwiki/index.php/Tutorial:_Create_an_MPI_Cluster_on_the_Amazon_Elastic_Cloud_%28EC2%29
>
> BTW: --download-mpich is a convient way to install MPI. [we default to
> device=ch3:sock]. But you might want to figureout if there is a better
> performing MPI for the amazon config.  [perhaps mpich with nemesis
> works well. Or perhaps openmpi. Both are available prebuit on
> ubunutu...]
>
> Satish
>
>> >>
>> >>   has anyone here tried/managed to install PETSc on e.g. Amazon AWS or
>> >> the Google Compute Engine?
>> >>
>> >> I believe some extra components are needed for coordination, e.g.
>> >> Kubernetes or Mesos (in turn requiring that the library be compiled
>> >> within some sort of container, e.g. Docker), but I'm a bit lost amid
>> >> all the options.


[petsc-users] installation on cloud platform

2016-01-03 Thread Marco Zocca
Dear all,

  has anyone here tried/managed to install PETSc on e.g. Amazon AWS or
the Google Compute Engine?

I believe some extra components are needed for coordination, e.g.
Kubernetes or Mesos (in turn requiring that the library be compiled
within some sort of container, e.g. Docker), but I'm a bit lost amid
all the options.

Are the MPI functions (e.g. broadcast, scatter, gather ..?) used by
PETSc compatible with those platforms?

Thank you in advance,

Marco


[petsc-users] LP solvers based on PETSc ?

2015-12-29 Thread Marco Zocca
Dear all,

  Is anyone here aware of linear program solvers, of any form, being
implemented on top of PETSc ?

Thank you in advance,

Marco


Re: [petsc-users] Eigenvalue problem in batch petsc-users Digest, Vol 84, Issue 59

2015-12-18 Thread Marco Zocca
Hi Venkatesh,

 it sounds like a job for the batch scheduler; again, a "bash" problem,
with some additional variables:

On a RHEL cluster, I was using Torque/PBS, which gives the `qsub`, `qstat`
commands. I would guess that Cray has analogous ones .

PETSc and SLEPc are instead toolkits for splitting the individual solutions
in bands or blocks that can be solved in parallel.

These are two distinct levels of parallelization for the total
computational task.

Best regards,
Marco





>
> Hi all,
> I am using Petsc and Slepc to solve my eigenvalue problem.
>
> I have 1000 A and B matrices saved as binary files. So I use in my script :
>
> *aprun -n 1 -N 1 ./ex7 -f1 A -f2 B -st_type sinvert -eps_target 0.01 *
>
> This is for one A and one B. So, how to do it for each A and B in multiple
> cores ?
>
> Pls. let me know.
>
> Thank you
> Venkatesh
> -- next part --
>
>
> Hi,
> I have access to Cray with many cores.
> It takes about 100 secs to solve in a single core. If I require to solve it
> sequentially, it will take a lot of time.
> Ok I can ask the admins, but in case you have an idea, pls. let me know.
>
> Best Regards,
> Venkatesh
>
> On Fri, Dec 18, 2015 at 2:32 PM, Timoth?e Nicolas <
> timothee.nico...@gmail.com> wrote:
>
> > You need to be more specific, what kind of machine do you have ? If you
> > have very few cores, it will not help much to launch them all at the same
> > time, but at least you can make the thing automatic using the loop as I
> > told you. Your computer will solve the first problem and then
> automatically
> > go to the second etc etc. How much time does it take do perform your task
> > on one set of matrices A and B ?
> >
> > If you are on a cluster with many many cores, then you can probably
> launch
> > your task in parallel, but I don't know how to do this exactly. But if
> it's
> > a cluster, you can ask the administrators.
> >
> > Best
> >
> > Timothee
> >
>
>


[petsc-users] shared components for real- and complex-scalar builds

2015-11-16 Thread Marco Zocca
Currently, I'm re-building fblaslapack and mpich along with PETSc for both
cases, but would it be possible to share either between the two builds?

Thank you,
Marco


[petsc-users] modeling a dual mesh

2015-11-14 Thread Marco Zocca
What construct can I use to build and keep track (i.e. map over) a
staggered index set, i.e. the dual (vertices, elements) meshes for a FEM
application.

I am looking for the equivalent, on a regular mesh, of the `sieve`
construction (
http://www.mcs.anl.gov/petsc/documentation/tutorials/sieve.pdf , which I
understand to be only available for DMPLEX).

I could hack together my own by using DM and IS, but I'd first like to be
sure about the non-existence of current implementations.

Thank you in advance,

Marco


[petsc-users] on SNESSetJacobian semantics

2015-10-22 Thread Marco Zocca
The signature of SNESSetJacobian is

PetscErrorCode  SNESSetJacobian(SNES snes,Mat Amat,Mat Pmat,PetscErrorCode
(*J)(SNES,Vec,Mat,Mat,void*),void *ctx)

however it would seem redundant to supply both a constant matrix and a
function to compute the Jacobian.
The manual says of J "(if NULL then SNES retains any previously set value":
this would only apply to linear functions, is this correct?

Why then are there not two monomorphic "SetJacobian" functions, one for
linear maps that wouldn't require recomputation and one for every other
case ?

Coming from a functional background, I find reasoning with "NULL" to be
very error-prone.

Thank you,
Marco


Re: [petsc-users] on SNESSetJacobian semantics

2015-10-22 Thread Marco Zocca
Thank you, but this is not really helping;

why are there two slots to supply the Jacobian of the same function, i.e.
Amat and J ?





On 22 October 2015 at 16:30, Matthew Knepley <knep...@gmail.com> wrote:

> On Thu, Oct 22, 2015 at 9:20 AM, Marco Zocca <zocca.ma...@gmail.com>
> wrote:
>
>> The signature of SNESSetJacobian is
>>
>> PetscErrorCode  SNESSetJacobian(SNES snes,Mat Amat,Mat
>> Pmat,PetscErrorCode (*J)(SNES,Vec,Mat,Mat,void*),void *ctx)
>>
>> however it would seem redundant to supply both a constant matrix and a
>> function to compute the Jacobian.
>> The manual says of J "(if NULL then SNES retains any previously set
>> value": this would only apply to linear functions, is this correct?
>>
>
> It means, if you give NULL, but have previously called SetJacobian() then
> it uses the function pointer previously passed
> rather than setting it to NULL.
>
>
>


[petsc-users] [ANN] PETSc Haskell bindings

2015-10-04 Thread Marco Zocca
Dear all,

development of the Haskell bindings for the PETSc scientific
computation library is now public; the repository can be found at

https://github.com/ocramz/petsc-hs

The interface is still very much experimental and in a state of flow
but a number of basic functions are working.

I look forward to all feedback;
Kind regards,

Marco Zocca


Re: [petsc-users] human-readable examples and PETSc idioms

2015-07-10 Thread Marco Zocca
Thank you for the reply;

  let me improve my question: in e.g. a FEM code, we need:


*) a mesh table :: [element - [face - [edge - [node] ] ] ]

*) one or more reference elements with associated basis over elements
and/or faces and Jacobians, or a quadrature rule to represent
integration over the real-space elements, for each element

*) one or more scalar/tensor coefficients per element


Assembly (in the simplest case) of the global matrix is then a single
loop over elements.


I would like to use the highest-level primitives for this task (I am
tackling a stochastic PDE-constrained optimization problem, so
complexity control and modularity is paramount ), could you provide
some hints ?

Thank you again and kind regards,
Marco






I'm looking for some non-optimized PETSc code; namely, I struggle a
 bit with generalizing the provided examples. On one hand inlined
 elementary operations help keep track of the FLOPs but make for
 hard-to read code.



 You can use MatSetValuesStencil() as is done here:

 http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex50.c.html

 on line 162.



 , removed comments for space) we are interested in forming a matrix A
 from the values contained in a vector x; i.e. some 'map' operation
 that sweeps x and prepares rows of A at a time according to some fixed
 stencil, with separate treatment of boundary values .

 Isn't there an idiom to abstract out this functionality? It's one of
 the most common operations in numerical PDE codes:


 Actually, this is only common is toy example. Almost no real PDEs have a
 fixed stencil
 because you have material coefficients, or nonlinearities, or constraints,
 etc.

Matt


[petsc-users] human-readable examples and PETSc idioms

2015-07-09 Thread Marco Zocca
Hello,
   I'm looking for some non-optimized PETSc code; namely, I struggle a
bit with generalizing the provided examples. On one hand inlined
elementary operations help keep track of the FLOPs but make for
hard-to read code.

For instance, KSP example 2, (
http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex2.c.html
), isn't there a better abstraction to defining the finite-difference
grid Laplacian than the following?

for (Ii=Istart; IiIend; Ii++) {
  v = -1.0; i = Ii/n; j = Ii - i*n;
  if (i0)   {J = Ii - n; MatSetValues(A,1,Ii,1,J,v,ADD_VALUES);}
  if (im-1) {J = Ii + n; MatSetValues(A,1,Ii,1,J,v,ADD_VALUES);}
  if (j0)   {J = Ii - 1; MatSetValues(A,1,Ii,1,J,v,ADD_VALUES);}
  if (jn-1) {J = Ii + 1; MatSetValues(A,1,Ii,1,J,v,ADD_VALUES);}
  v = 4.0; MatSetValues(A,1,Ii,1,Ii,v,ADD_VALUES);
}

I see this approach as very error prone, yet this is one of the
simplest examples.

Another problematic trend I see is hardcoding constants and
assumptions on the functions, e.g. in the following (taken from
http://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex2.c.html
, removed comments for space) we are interested in forming a matrix A
from the values contained in a vector x; i.e. some 'map' operation
that sweeps x and prepares rows of A at a time according to some fixed
stencil, with separate treatment of boundary values .

Isn't there an idiom to abstract out this functionality? It's one of
the most common operations in numerical PDE codes:

VecGetArrayRead(x,xx);

VecGetSize(x,n);
d= (PetscReal)(n - 1); d = d*d;

for (i=1; in-1; i++) {
  j[0] = i - 1; j[1] = i; j[2] = i + 1;
  A[0] = A[2] = d; A[1] = -2.0*d + 2.0*xx[i];
  MatSetValues(jac,1,i,3,j,A,INSERT_VALUES);
}

i = 0;   A[0] = 1.0;
MatSetValues(jac,1,i,1,i,A,INSERT_VALUES);

i = n-1; A[0] = 1.0;

MatSetValues(jac,1,i,1,i,A,INSERT_VALUES);

VecRestoreArrayRead(x,xx);


I think it would be extremely helpful if the developers of the
examples spent a little time in adding theory annotations to the code,
and I would be very thankful if anybody could point me to relevant
tutorials and literature.

Thank you in advance and kind regards,
Marco Zocca