palabos 1.5 and CodeBlocks(Windows)

I am using codeBLocks under windows and the compiler gcc 4.7.1
I don’nt know if I am doing sth wrong but I am testing the new version and when I tried to compile the generalExteranlFlow showCase, i get:


Z:\palabos-v1.5r0\src\core\plbTimer.cpp||In member function 'void plb::global::PlbTimer::start()':|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|51|error: 'timespec' was not declared in this scope|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|51|error: expected ';' before 'ts'|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|52|error: 'CLOCK_REALTIME' was not declared in this scope|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|52|error: 'ts' was not declared in this scope|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|52|error: 'clock_gettime' was not declared in this scope|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp||In member function 'double plb::global::PlbTimer::getTime() const':|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|82|error: 'timespec' was not declared in this scope|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|82|error: expected ';' before 'ts'|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|83|error: 'CLOCK_REALTIME' was not declared in this scope|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|83|error: 'ts' was not declared in this scope|
Z:\palabos-v1.5r0\src\core\plbTimer.cpp|83|error: 'clock_gettime' was not declared in this scope|
||=== Build failed: 10 error(s), 34 warning(s) (1 minute(s), 22 second(s)) ===|


The corresponding part of the code is this part

[code=“cpp”]
void PlbTimer::start() {
#ifdef PLB_MPI_PARALLEL
startTime = mpi().getTime();
#else
#ifdef PLB_USE_POSIX
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
startTime = (double) ts.tv_nsec * (double) 1.0e-9;
#else
startClock = clock();
#endif
#endif
isOn = true;
}

Dear DavidA,

Thank you for trying out the new release of Palabos!

You are using Windows, so can you please try in the Makefile to set:

usePOSIX = false

Best Regards,
Dimitris

You will have to excuse becouse of my lack of programming knowledge but I am using the codeblocks template provided and using the procedure described on Compilation under Windows (and under many other OSes) with the integrated development environment Code::Blocks in the User guide. Does it use the makefile provided in …\palabos-v1.5r0\examples\showCases\generalExternalFlow?

Anyway I tried it and it wont work, I think you are refering on another way of compiling the program.

Kind regards and thanks for your time

Dear DavidA,

Please try the following:

In CodeBlocks, go to:

Project -> Build options … -> Compiler Settings -> #defines

and delete PLB_USE_POSIX

Then try to build aigain.

Hope this helps…

Best,
Dimitris

Dear Dimitris,

Unfortunatly it keeps giving the error. What’s the purpose of that part of the code? Is it just debugging? What if I comment it?

Thanks again
pd: I saw it is for monitoring time spent between iterations. Now the program is working without that feature. I am open to any try you’d like to do in order to try to fix it.

Dear DavidA,

OK, then as a last resort, do the following. Fully replace the file “plbTimer.h” with:

[code=cpp]
/* This file is part of the Palabos library.
*

  • Copyright © 2011-2015 FlowKit Sarl
  • Route d’Oron 2
  • 1010 Lausanne, Switzerland
  • E-mail contact: contact@flowkit.com
  • The most recent release of Palabos can be downloaded at
  • http://www.palabos.org/
  • The library Palabos is free software: you can redistribute it and/or
  • modify it under the terms of the GNU Affero General Public License as
  • published by the Free Software Foundation, either version 3 of the
  • License, or (at your option) any later version.
  • The library is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Affero General Public License for more details.
  • You should have received a copy of the GNU Affero General Public License
  • along with this program. If not, see http://www.gnu.org/licenses/.
    */

/** \file

  • A timer class for benchmarking program parts – header file.
    */
    #ifndef PLB_TIMER_H
    #define PLB_TIMER_H

#include

namespace plb {

namespace global {

/// A cumulative timer for benchmarking program parts and summing up the times.
/** In serial, the C function clock() is used. In parallel, the MPI

  • function is used.
    /
    class PlbTimer {
    public:
    PlbTimer();
    /// Proceed with time measurement.
    void start();
    /// Reset timer to zero and start time measurement.
    void restart();
    /// Interrupt time measurement ( you can still proceed with start() ).
    /
    \return Current cumulative time.
    */
    double stop();
    /// Reset timer to zero.
    void reset();
    /// Get current cumulative time.
    double getTime() const;
    private:
    double cumulativeTime;
    bool isOn;
    #ifdef PLB_MPI_PARALLEL
    double startTime;
    #else
    clock_t startClock;
    #endif
    friend PlbTimer& timer(std::string nameOfTimer);
    friend PlbTimer& plbTimer(std::string nameOfTimer);
    };

// Global instance of timer objects, for public use.
PlbTimer& timer(std::string nameOfTimer);

// Global instance of timer objects, for internal use.
PlbTimer& plbTimer(std::string nameOfTimer);

/// A cumulative counter for benchmarking program parts and summing up occurrences
/// of events.
class PlbCounter {
public:
PlbCounter();
/// Increment the counter.
plint increment(plint value=1);
/// Reset counter to zero.
void reset();
/// Return current count.
plint getCount() const;
private:
plint count;
friend PlbCounter& counter(std::string nameOfCounter);
friend PlbCounter& plbCounter(std::string nameOfCounter);
};

// Global instance of counter objects, for public use.
PlbCounter& counter(std::string nameOfCounter);

// Global instance of counter objects, for internal use.
PlbCounter& plbCounter(std::string nameOfCounter);

} // namespace global

} // namespace plb

#endif // PLB_TIMER_H



and the file "plbTimer.cpp" with:

[code=cpp]
/* This file is part of the Palabos library.
 *
 * Copyright (C) 2011-2013 FlowKit Sarl
 * Route d'Oron 2
 * 1010 Lausanne, Switzerland
 * E-mail contact: contact@flowkit.com
 *
 * The most recent release of Palabos can be downloaded at 
 * <http://www.palabos.org/>
 *
 * The library Palabos is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * The library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "parallelism/mpiManager.h"
#include "core/plbTimer.h"
#include <map>

#ifndef PLB_MPI_PARALLEL
#include <time.h>
#endif

namespace plb {

namespace global {

/* ************** Timer ***************************************** */

PlbTimer::PlbTimer()
    : cumulativeTime(0.),
      isOn(false)
{ }

void PlbTimer::start() {
#ifdef PLB_MPI_PARALLEL
    startTime = mpi().getTime();
#else
    startClock = clock();
#endif
    isOn = true;
}

void PlbTimer::restart() {
    reset();
    start();
}

double PlbTimer::stop() {
    cumulativeTime = getTime();
    isOn = false;
    return cumulativeTime;
}

void PlbTimer::reset() {
    cumulativeTime = 0.;
}

double PlbTimer::getTime() const {
    if (isOn) {
#ifdef PLB_MPI_PARALLEL
        return cumulativeTime + mpi().getTime()-startTime;
#else
        return cumulativeTime + (double)(clock()-startClock)
                              / (double)CLOCKS_PER_SEC;
#endif
    }
    else {
        return cumulativeTime;
    }
}

PlbTimer& timer(std::string nameOfTimer) {
    static std::map<std::string, PlbTimer> timerCollection;
    return timerCollection[nameOfTimer];
}

PlbTimer& plbTimer(std::string nameOfTimer) {
    static std::map<std::string, PlbTimer> timerCollection;
    PlbTimer& answer=timerCollection[nameOfTimer];
    return answer;
}

/* ************** Timer ***************************************** */

PlbCounter::PlbCounter()
    : count(0)
{ }

plint PlbCounter::increment(plint value) {
    count += value;
    return count;
}

void PlbCounter::reset() {
    count = 0;
}

plint PlbCounter::getCount() const {
    return count;
}

PlbCounter& counter(std::string nameOfCounter) {
    static std::map<std::string, PlbCounter> counterCollection;
    return counterCollection[nameOfCounter];
}

PlbCounter& plbCounter(std::string nameOfCounter) {
    static std::map<std::string, PlbCounter> counterCollection;
    return counterCollection[nameOfCounter];
}

}  // namespace global

}  // namespace plb

I hope this will do the trick!

Best,
Dimitris

Working! Great job, I am continuing trying the program.

Thanks for all the work to the palabos team

Sorry again. The cavity case works perfectly but when i switched to generalExternalFlow I recived the following compilation error:


undefined reference to `plb::loadState(std::vector<plb::MultiBlock3D*, std::allocator<plb::MultiBlock3D*> >, int&, bool, plb::FileName)'|
obj\Release\examples\showCases\generalExternalFlow\generalExternalFlow.o:generalExternalFlow.cpp:(.text.startup+0x1220)||undefined reference to `plb::saveState(std::vector<plb::MultiBlock3D*, std::allocator<plb::MultiBlock3D*> >, int, bool, plb::FileName, plb::FileName, int)'|
obj\Release\examples\showCases\generalExternalFlow\generalExternalFlow.o:generalExternalFlow.cpp:(.text.startup+0x1686)||undefined reference to `plb::abortExecution(plb::FileName, std::vector<plb::MultiBlock3D*, std::allocator<plb::MultiBlock3D*> >, int, bool, plb::FileName, plb::FileName, int)'|
||=== Build failed: 3 error(s), 34 warning(s) (2 minute(s), 18 second(s)) ===|

Dear DavidA,

Sorry about all of this. It is because we never compile with code-blocks here… Can you please replace all the “Palabos.cbp” file with:

[code=cpp]

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<CodeBlocks_project_file>































































































































































	<Extensions>
		<code_completion />
		<debugger />
	</Extensions>
</Project>

</CodeBlocks_project_file>



Try again to compile (not the cavity2d but) the generalExternalFlow example and please let me know if you succeed.

Best,
Dimitris

Thanks again Dimitris,

Don’t worry, I trully appreciate your work and I suppose that you use Linux (I should too but becouse of another software I cant …). I keep getting errors, I am attaching them:



obj\Release\src\multiPhysics\bubbleMatch3D.o:bubbleMatch3D.cpp:(.text$_ZN3plb18MultiScalarField3DIiEC1ERKNS_12MultiBlock3DE[__ZN3plb18MultiScalarField3DIiEC1ERKNS_12MultiBlock3DE]+0x115)||undefined reference to `plb::SerialScalarAccess3D<int>::SerialScalarAccess3D()'|
obj\Release\src\multiPhysics\bubbleMatch3D.o:bubbleMatch3D.cpp:(.text$_ZN3plb33defaultGenerateMultiScalarField3DIiEESt8auto_ptrINS_18MultiScalarField3DIT_EEERKNS_22MultiBlockManagement3DES3_[__ZN3plb33defaultGenerateMultiScalarField3DIiEESt8auto_ptrINS_18MultiScalarField3DIT_EEERKNS_22MultiBlockManagement3DES3_]+0xc4)||undefined reference to `plb::SerialScalarAccess3D<int>::SerialScalarAccess3D()'|
||=== Build failed: 2 error(s), 34 warning(s) (2 minute(s), 25 second(s)) ===|


It marks the first if in this part of Part.h

[code=“cpp”]
inline Scalar coeff(int row, int col) const
{
// SelfAdjointBit doesn’t play any role here: just because a matrix is selfadjoint doesn’t say anything about
// each individual coefficient, except for the not-very-useful-here fact that diagonal coefficients are real.
if( ((Flags & LowerTriangularBit) && (col>row)) || ((Flags & UpperTriangularBit) && (row>col)) )
return (Scalar)0;
if(Flags & UnitDiagBit)
return col==row ? (Scalar)1 : m_matrix.coeff(row, col);
else if(Flags & ZeroDiagBit)
return col==row ? (Scalar)0 : m_matrix.coeff(row, col);
else
return m_matrix.coeff(row, col);
}




Regards

Dear DavidA,

Please try the following: In the file “src/multiPhysics/bubbleMatch3D.cpp” in the list of “include” files add these two lines:

[code=cpp]
#include “multiBlock/serialMultiDataField3D.h”
#include “multiBlock/serialMultiDataField3D.hh”



Let me know in case of more errors! Thanks a lot, and let me apologize once again!

Best,
Dimitris

Seem to working now! Thanks a lot Dimitris. I will play with it and let you know. The idea is validate the results from the example geometries with literature and other softwares as a first step, let me know if you have done some correlation of this kind.

Regards and great job

I am using codeBLocks under windows and the compiler gnu gcc
I tried to compile the cavity 2d showCase, i get this build log:


-------------- Build: Release in Palabos (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -O3 -DPLB_USE_POSIX -I..\src -I..\externalLibraries -c C:\Users\Maurizio\Documents\Materiale_Università\Palabos\palabos-v1.5r0\src\parallelism\parallelBlockCommunicator3D.cpp -o obj\Release\src\parallelism\parallelBlockCommunicator3D.o
C:\Users\Maurizio\Documents\Materiale_Università\Palabos\palabos-v1.5r0\src\parallelism\parallelBlockCommunicator3D.cpp:36:17: mpi.h: No such file or directory
Process terminated with status 1 (0 minute(s), 8 second(s))
1 error(s), 0 warning(s) (0 minute(s), 8 second(s))


This is the corresponding part of code:

[code=“cpp”]
/* This file is part of the Palabos library.
*

  • Copyright © 2011-2013 FlowKit Sarl
  • Route d’Oron 2
  • 1010 Lausanne, Switzerland
  • E-mail contact: contact@flowkit.com
  • The most recent release of Palabos can be downloaded at
  • http://www.palabos.org/
  • The library Palabos is free software: you can redistribute it and/or
  • modify it under the terms of the GNU Affero General Public License as
  • published by the Free Software Foundation, either version 3 of the
  • License, or (at your option) any later version.
  • The library is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Affero General Public License for more details.
  • You should have received a copy of the GNU Affero General Public License
  • along with this program. If not, see http://www.gnu.org/licenses/.
    */

/** \file

  • Helper classes for parallel 3D multiblock lattice – generic implementation.
    */

#include “parallelism/parallelBlockCommunicator3D.h”
#include “multiBlock/multiBlock3D.h”
#include “multiBlock/multiBlockManagement3D.h”
#include “atomicBlock/atomicBlock3D.h”
#include “core/plbDebug.h”
#include “core/plbProfiler.h”
#include
#include <mpi.h>



I don't have the header file mpi.h, i only have mpiParalleIO.h and mpiManager.h.
What should i do?

Dear Mario,

Please try to replace the line:


#include <mpi.h>

with:


#ifdef PLB_MPI_PARALLEL
#include <mpi.h>
#endif

and recompile.

Best,
Dimitris

Thanks dimitris,
now the code is compiled, but palabos doesn’t work.
I have tried with many files from showcases (cavity2d, dipole, poiseuille, movingWall etc…)
The output is:


Process returned -1073741819 (0xC0000005) execution time 0.998s
Press any key to continue

What is the problem?

Dear all,

My name is Leonel, I am a student from Universitas Padjadjaran, Indonesia.

I have some problem when compiling the carreauPoisseuille program, It produced some errors I attach below

python2 …/…/…/scons/scons.py -j 6 -f …/…/…/SConstruct palabosRoot=…/…/… projectFiles=“carreauPoiseuille.cpp” optimize=true debug=true profile=false MPI parallel=true SMPparallel=false usePOSIX=true serialCXX=g++ parallelCXX=mpicxx c ompileFlags="-Wall -Wnon-virtual-dtor" linkFlags="" optimFlags="-O3" debugFlags= “-g” profileFlags="-pg" libraryPaths="" includePaths="" libraries=""
/bin/sh: python2: not found
make: *** [compile] Error 127

Need your advice how to solve this problem

regards,
Leo

Hello
I am having the same problem as david but it is with cavity2d.cpp. BTW I am new and I would appreciate any help. I am using latest version of palabos.
Part of the program causing the error indicated by code block.

[code=“fortran”]
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
startTime = (double) ts.tv_nsec * (double) 1.0e-9;



Errors:

D:\fortran compiler\palabos-v1.5r1\src\core\plbTimer.cpp: In member function 'void plb::global::PlbTimer::start()':
D:\fortran compiler\palabos-v1.5r1\src\core\plbTimer.cpp:50:19: error: 'CLOCK_REALTIME' was not declared in this scope
     clock_gettime(CLOCK_REALTIME, &ts);
                   ^
D:\fortran compiler\palabos-v1.5r1\src\core\plbTimer.cpp:50:38: error: 'clock_gettime' was not declared in this scope
     clock_gettime(CLOCK_REALTIME, &ts);
                                      ^
D:\fortran compiler\palabos-v1.5r1\src\core\plbTimer.cpp: In member function 'double plb::global::PlbTimer::getTime() const':
D:\fortran compiler\palabos-v1.5r1\src\core\plbTimer.cpp:81:23: error: 'CLOCK_REALTIME' was not declared in this scope
         clock_gettime(CLOCK_REALTIME, &ts);                      
D:\fortran compiler\palabos-v1.5r1\src\core\plbTimer.cpp:81:42: error: 'clock_gettime' was not declared in this scope
         clock_gettime(CLOCK_REALTIME, &ts);

hi

i’m trying to run palabos tutorials in code blocks in windows 10. it is showing “fatal error: palabos2d.h :no such file or directory”
help me to run the codes in windows

I try to replace all the setting

the build messages change to:

||=== Build: Release in Palabos (compiler: GNU GCC Compiler) ===|
=||No such file or directory|
false||No such file or directory|
=||No such file or directory|
false||No such file or directory|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

the build log shows:

mingw32-g++.exe: error: false: No such file or directory
mingw32-g++.exe: error: =: No such file or directory
mingw32-g++.exe: error: false: No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
4 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Hi palabos team,
I’m using the latest version of Palabos for my thesis project with CodeBlocks under windows.
I tried to compile the cavity 2d showCase and i get this build messages:

||=== Build: Release in Palabos (compiler: GNU GCC Compiler) ===|
C:\Users\Francesco\Università\Tesi magistrale\palabos-v1.5r1\src\core\plbTimer.cpp||In member function ‘void plb::global::PlbTimer::start()’:expressionless:
C:\Users\Francesco\Università\Tesi magistrale\palabos-v1.5r1\src\core\plbTimer.cpp|50|error: ‘CLOCK_REALTIME’ was not declared in this scope|
C:\Users\Francesco\Università\Tesi magistrale\palabos-v1.5r1\src\core\plbTimer.cpp|50|error: ‘clock_gettime’ was not declared in this scope|
C:\Users\Francesco\Università\Tesi magistrale\palabos-v1.5r1\src\core\plbTimer.cpp||In member function ‘double plb::global::PlbTimer::getTime() const’:expressionless:
C:\Users\Francesco\Università\Tesi magistrale\palabos-v1.5r1\src\core\plbTimer.cpp|81|error: ‘CLOCK_REALTIME’ was not declared in this scope|
C:\Users\Francesco\Università\Tesi magistrale\palabos-v1.5r1\src\core\plbTimer.cpp|81|error: ‘clock_gettime’ was not declared in this scope|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Where is the problem?
Thank you.
Regards