0

I am interested in using the open source code discussed here. The framework and some instruction on how to run the code is discussed here. To be able to use the code one should first install PETSc. I have done this and it seems to be correctly installed. The problem rises when I try to run make topopt following the instructions given in the paper (section 2.2). On the GitHub there exists a makefile_ref where following the instructions given in the paper I make the following changes: PETSC_DIR=\home\myusername\petsc and PETSC_ARCH=arch-linux-c-debug. After running make -d topopt I get the following error:

GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating makefiles....
 Considering target file 'GNUmakefile'.
  File 'GNUmakefile' does not exist.
  Looking for an implicit rule for 'GNUmakefile'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.o'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.c'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.cc'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.C'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.cpp'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.p'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.f'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.F'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.m'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.r'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.s'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.S'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.mod'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.sh'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile,v'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'RCS/GNUmakefile,v'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'RCS/GNUmakefile'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 's.GNUmakefile'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'SCCS/s.GNUmakefile'.
  Trying pattern rule with stem 'GNUmakefile'.
  Trying implicit prerequisite 'GNUmakefile.o'.
  Looking for a rule with intermediate file 'GNUmakefile.o'.
   Avoiding implicit rule recursion.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.c'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.cc'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.C'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.cpp'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.p'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.f'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.F'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.m'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.r'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.s'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.S'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.mod'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 'GNUmakefile.o,v'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 'RCS/GNUmakefile.o,v'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 'RCS/GNUmakefile.o'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 's.GNUmakefile.o'.
   Trying pattern rule with stem 'GNUmakefile.o'.
   Trying implicit prerequisite 'SCCS/s.GNUmakefile.o'.
   Trying pattern rule with stem 'GNUmakefile'.
   Trying implicit prerequisite 'GNUmakefile.c'.
   Looking for a rule with intermediate file 'GNUmakefile.c'.
    Avoiding implicit rule recursion.
    Avoiding implicit rule recursion.
    Trying pattern rule with stem 'GNUmakefile'.
    Trying implicit prerequisite 'GNUmakefile.y'.
    Trying pattern rule with stem 'GNUmakefile'.
.
.
.
.
.
.
.
.
.
.
Looking for a rule with intermediate file 'topopt.mod'.
   Avoiding implicit rule recursion.
   Avoiding implicit rule recursion.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 'topopt.mod,v'.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 'RCS/topopt.mod,v'.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 'RCS/topopt.mod'.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 's.topopt.mod'.
   Trying pattern rule with stem 'topopt.mod'.
   Trying implicit prerequisite 'SCCS/s.topopt.mod'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.c'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.cc'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.C'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.cpp'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.p'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.f'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.F'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.m'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.r'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.s'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.S'.
 Trying pattern rule with stem 'topopt'.
 Rejecting impossible implicit prerequisite 'topopt.mod'.
 Trying pattern rule with stem 'topopt'.
 Trying implicit prerequisite 'topopt.sh'.
 Looking for a rule with intermediate file 'topopt.sh'.
  Avoiding implicit rule recursion.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 'topopt.sh,v'.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 'RCS/topopt.sh,v'.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 'RCS/topopt.sh'.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 's.topopt.sh'.
  Trying pattern rule with stem 'topopt.sh'.
  Trying implicit prerequisite 'SCCS/s.topopt.sh'.
 No implicit rule found for 'topopt'.
 Finished prerequisites of target file 'topopt'.
Must remake target 'topopt'.
make: *** No rule to make target 'topopt'.  Stop.

The code above is only a fraction of the whole message (the starting fraction and the ending fraction).

I am working on Ubuntu 20.04.

Thanks in advance.

Dude
  • 191
  • 3
  • 12

2 Answers2

1

there exists a makefile_ref where following the instructions given in the paper I make the following changes [...]

Absent an explicit option specifying a makefile to read, the make utility looks for input files by several alternative names. makefile_ref is not one of them. I take the "_ref" part of the filename as mnemonic for "reference", and from that perspective the intention appears to be that you copy makefile_ref to, say, makefile (one of the file names that make does look for by default), and modify the copy to be appropriate for your environment.

John Bollinger
  • 160,171
  • 8
  • 81
  • 157
  • thanks for your answer although it doesn't really clarify the situation. For instance why would you assume that the `makefile_ref` is not the `makefile` used by `make`? Is it because its content doesn't resemble the content of a makefile? for instance I don't see any g++ compiler in this file, is it normal? – Dude Apr 20 '21 at 19:14
  • 1
    @Dude, I would assume that `makefile_ref` is not read by `make` because there is a specific list of file names that `make` checks, absent an explicit option specifying a makefile. For GNU make, the list is: `GNUmakefile`, `makefile`, and `Makefile`, in that order. I also observe that the diagnostics output by `make` suggest that it is in fact attempting to build the requested target without reference to the contents of `makefile_ref` as those appear in the GH repository, and I know that `make` can operate without any makefile at all. – John Bollinger Apr 20 '21 at 20:08
  • Thank you for your comments. I am actually under the impression that the problem comes from trying to compile the code by including the PETSc libraries. – Dude Apr 21 '21 at 06:49
  • 1
    @Dude, the diagnostic messages from `make` that you have presented do not support that conclusion. But if you already know, contrary to the apparent evidence, what the problem is, then what is the point of asking the question? – John Bollinger Apr 21 '21 at 12:47
  • The point of asking a question is to start a conversation that may or may not lead to the right answer. Apart from that, asking a question does not necessary mean that the person who asks the question is completely ignorant of the problem, it is still acceptable for the inquirer to have his/her own interpretation of the problem and share it with the community for feedback. Anyway thanks for your comments, they were helpful. – Dude Apr 21 '21 at 13:13
0

ANSWER:

Well it turns out that compiling the topology optimization code given on GitHub is not so complicated after all. Here I reiterate what has been given as instructions on GitHub with some more detail.

To run the topology optimization open source code using PETSc one first needs to install PETSc. You should pay attention that to install PETSc you are going to need BLAS and LAPACK libraries installed, it is very straightforward and the instructions are given in PETSc. Now that PETSc is installed on the system one simply needs to clone TopOpt_in_PETSc from GitHub.

You will find a file called makefile_ref, change the name of the file to makefile then open it and on the first two lines of the code modify the path, which would be something like this PETSC_DIR=/home/username/petsc and PETSC_ARCH=arch-linux-c-debug (this is in my case and could be different depending on your machine). The former ommand is the path to the directory where PETSc is installed on your local machine and the latter is the build name of PETSc.

Once the above-mentioned manipulation is done you can run make topopt and it will build you an executable called topopt. Following the instructions given in the paper you will be able to run the simulations on topology optimization.

REMARK: The installation instructions given above are performed on ubuntu 20.04 LTS, although PETSc is also compatible with Windows and iOS and even Android. On the other hand TopOpt_in_PETSc is developed and implemented on linux and propably needs further manipulation to be installed on Windows.

Dude
  • 191
  • 3
  • 12