atanuchaudhury / linux-Problem

0 stars 0 forks source link

Having problrm regarding `running the program in GPU #1

Open atanuchaudhury opened 9 months ago

atanuchaudhury commented 9 months ago

Tried to run the config file but givving out error in my system. But the same process is running seamlessly in other System. I have installed Clang As well. The problem is given below:

fetchbook@DESKTOP-AA6KOUT:/mnt/c/Users/YD/Documents/olb-1.6r0$ make clean make CXX=nvcc CC=nvcc -C external clean make[1]: Entering directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external' make -C zlib clean make[2]: Entering directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external/zlib' make[2]: Leaving directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external/zlib' make -C tinyxml clean make[2]: Entering directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external/tinyxml' make[2]: Leaving directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external/tinyxml' rm -f lib/libz.a lib/libtinyxml.a make[1]: Leaving directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external' rm -f src/communication/mpiManager.o src/communication/ompManager.o src/core/olbInit.o src/io/ostreamManager.o rm -f build/lib/libolbcore.a fetchbook@DESKTOP-AA6KOUT:/mnt/c/Users/YD/Documents/olb-1.6r0$ make make CXX=nvcc CC=nvcc -C external make[1]: Entering directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external' make -C zlib make[2]: Entering directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external/zlib' nvcc -c -o build/adler32.o ./adler32.c nvcc -c -o build/crc32.o ./crc32.c nvcc -c -o build/deflate.o ./deflate.c nvcc -c -o build/infback.o ./infback.c nvcc -c -o build/inffast.o ./inffast.c nvcc -c -o build/inflate.o ./inflate.c nvcc -c -o build/inftrees.o ./inftrees.c nvcc -c -o build/trees.o ./trees.c nvcc -c -o build/zutil.o ./zutil.c nvcc -c -o build/compress.o ./compress.c nvcc -c -o build/uncompr.o ./uncompr.c nvcc -c -o build/gzclose.o ./gzclose.c nvcc -c -o build/gzlib.o ./gzlib.c nvcc -c -o build/gzread.o ./gzread.c nvcc -c -o build/gzwrite.o ./gzwrite.c ar rc build//libz.a ./build/adler32.o ./build/crc32.o ./build/deflate.o ./build/infback.o ./build/inffast.o ./build/inflate.o ./build/inftrees.o ./build/trees.o ./build/zutil.o ./build/compress.o ./build/uncompr.o ./build/gzclose.o ./build/gzlib.o ./build/gzread.o ./build/gzwrite.o make[2]: Leaving directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external/zlib' cp zlib/build/libz.a lib/ make -C tinyxml make[2]: Entering directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external/tinyxml' nvcc -c tinystr.cpp -o build/tinystr.o nvcc -c tinyxml.cpp -o build/tinyxml.o nvcc -c tinyxmlerror.cpp -o build/tinyxmlerror.o nvcc -c tinyxmlparser.cpp -o build/tinyxmlparser.o ar rc build/libtinyxml.a ./build/tinystr.o ./build/tinyxml.o ./build/tinyxmlerror.o ./build/tinyxmlparser.o make[2]: Leaving directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external/tinyxml' cp tinyxml/build/libtinyxml.a lib/ make[1]: Leaving directory '/mnt/c/Users/YD/Documents/olb-1.6r0/external' nvcc -O3 -std=c++17 --forward-unknown-to-host-compiler -pthread --forward-unknown-to-host-compiler -x cu -O3 -std=c++17 --generate-code=arch=compute_60,code=[compute_60,sm_60] --extended-lambda --expt-relaxed-constexpr -rdc=true -Xcudafe "--diag_suppress=implicit_return_from_non_void_function --display_error_number --diag_suppress=20014 --diag_suppress=20011" -**DPLATFORM_CPU_SISD -DPLATFORM_GPU_CUDA -DDEFAULT_FLOATING_POINT_TYPE=float -fPIC -Isrc/ -c src/communication/mpiManager.cpp -o src/communication/mpiManager.o /usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’: 435 | function(_Functor&& f) | ^ /usr/include/c++/11/bits/std_function.h:435:145: note: ‘_ArgTypes’ /usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’: 530 | operator=(_Functor&& f) | ^ /usr/include/c++/11/bits/std_function.h:530:146: note: ‘_ArgTypes’ make: * [Makefile:46: src/communication/mpiManager.o] Error 1 fetchbook@DESKTOP-AA6KOUT:/mnt/c/Users/YD/Documents/olb-1.6r0$

atanuchaudhury commented 8 months ago

new error "nvcc fatal : Don't know what to do with 'C:/Users/YD/Documents/olb-1.6r0/src'"

AstroSuro commented 8 months ago

Why are you putting this path?

AstroSuro commented 8 months ago

nvcc command is to compile the .cpp code. You dont need to have a path.

atanuchaudhury commented 8 months ago

I used this line also"nvcc -o cylinder2d cylinder2d.cpp", giving the same error

AstroSuro commented 8 months ago

Attach the screen shot.

atanuchaudhury commented 8 months ago

nvcc

AstroSuro commented 8 months ago

This means the file cannot be found. I dont know how your code looks like. Need more details on the code. Replace the .h file with the following and see if there is some error. Remove the web address before compiling.

include <core/core2D.h>

include <boundary/boundary2D.h>

include <communication/communication.h>

include <datatype.h>

include <dynamics/dynamics2D.h>

include <reaction/reaction2D.h>

include <functors/functors2D.h>

include <geometry/geometry2D.h>

include <io/io2D.h>

include <solver/solver.h>

include <optimization/opti2D.h>

include <utilities/utilities2D.h>

include <particles/particles.h>

atanuchaudhury commented 8 months ago

The code is

/ Lattice Boltzmann sample, written in C++, using the OpenLBlibrary

/* cylinder2d.cpp:

include "olb2D.h"

include "olb2D.hh"

using namespace olb; using namespace olb::descriptors; using namespace olb::graphics;

using T = FLOATING_POINT_TYPE; using DESCRIPTOR = D2Q9<>;

define BOUZIDI

// Parameters for the simulation setup const int N = 10; // resolution of the model const T Re = 20.; // Reynolds number const T maxPhysT = 35; // max. simulation time in s, SI unit const T L = 0.1/N; // latticeL const T lengthX = 2.2; const T lengthY = .41+L; const T centerCylinderX = 0.2; const T centerCylinderY = 0.2+L/2.; const T radiusCylinder = 0.05;

// Stores geometry information in form of material numbers void prepareGeometry( UnitConverter<T, DESCRIPTOR> const& converter, SuperGeometry<T,2>& superGeometry, std::shared_ptr<IndicatorF2D> circle) { OstreamManager clout( std::cout,"prepareGeometry" ); clout << "Prepare Geometry ..." << std::endl;

Vector<T,2> extend( lengthX,lengthY ); Vector<T,2> origin;

superGeometry.rename( 0,2 );

superGeometry.rename( 2,1,{1,1} );

// Set material number for inflow extend[0] = 2.*L; origin[0] = -L; IndicatorCuboid2D inflow( extend, origin ); superGeometry.rename( 2,3,1,inflow ); // Set material number for outflow origin[0] = lengthX-L; IndicatorCuboid2D outflow( extend, origin ); superGeometry.rename( 2,4,1,outflow ); // Set material number for cylinder superGeometry.rename( 1,5, circle );

// Removes all not needed boundary voxels outside the surface superGeometry.clean(); superGeometry.checkForErrors();

superGeometry.print();

clout << "Prepare Geometry ... OK" << std::endl; }

// Set up the geometry of the simulation void prepareLattice( SuperLattice<T,DESCRIPTOR>& sLattice, UnitConverter<T, DESCRIPTOR> const& converter, SuperGeometry<T,2>& superGeometry, std::shared_ptr<IndicatorF2D> circle) { OstreamManager clout( std::cout,"prepareLattice" ); clout << "Prepare Lattice ..." << std::endl;

const T omega = converter.getLatticeRelaxationFrequency();

// Material=1 -->bulk dynamics auto bulkIndicator = superGeometry.getMaterialIndicator({1}); sLattice.defineDynamics(bulkIndicator);

// Material=2 -->bounce back setBounceBackBoundary(sLattice, superGeometry, 2);

// Setting of the boundary conditions

//if boundary conditions are chosen to be local //setLocalVelocityBoundary(sLattice, omega, superGeometry, 3); //setLocalPressureBoundary(sLattice, omega, superGeometry, 4);

//if boundary conditions are chosen to be interpolated setInterpolatedVelocityBoundary(sLattice, omega, superGeometry, 3); setInterpolatedPressureBoundary(sLattice, omega, superGeometry, 4);

// Material=5 -->bouzidi / bounce back //#ifdef BOUZIDI setBouzidiBoundary(sLattice, superGeometry, 5, *circle); //#else //setBounceBackBoundary(sLattice, superGeometry, 5); //#endif

// New boundary conditions using setSlipBoundary //setSlipBoundary(sLattice, superGeometry, 5); //setSlipBoundary(sLattice, omega, superGeometry, 5, *circle);

// Initial conditions AnalyticalConst2D<T,T> rhoF( 1 ); std::vector velocity( 2,T( 0 ) ); AnalyticalConst2D<T,T> uF( velocity );

// Initialize all values of distribution functions to their local equilibrium sLattice.defineRhoU( bulkIndicator, rhoF, uF ); sLattice.iniEquilibrium( bulkIndicator, rhoF, uF );

sLattice.setParameter(omega);

// Make the lattice ready for simulation sLattice.initialize();

clout << "Prepare Lattice ... OK" << std::endl; }

// Generates a slowly increasing inflow for the first iTMaxStart timesteps void setBoundaryValues( SuperLattice<T, DESCRIPTOR>& sLattice, UnitConverter<T, DESCRIPTOR> const& converter, int iT, SuperGeometry<T,2>& superGeometry ) {

OstreamManager clout( std::cout,"setBoundaryValues" );

// No of time steps for smooth start-up int iTmaxStart = converter.getLatticeTime( maxPhysT*0.4 ); int iTupdate = 5;

if ( iT%iTupdate==0 && iT<= iTmaxStart ) { // Smooth start curve, sinus // SinusStartScale<T,int> StartScale(iTmaxStart, T(1));

// Smooth start curve, polynomial
PolynomialStartScale<T,T> StartScale( iTmaxStart, T( 1 ) );

// Creates and sets the Poiseuille inflow profile using functors
T iTvec[1] = {T( iT )};
T frac[1] = {};
StartScale( frac,iTvec );
T maxVelocity = converter.getCharLatticeVelocity()*3./2.*frac[0];
T distance2Wall = L/2.;
Poiseuille2D<T> poiseuilleU( superGeometry, 3, maxVelocity, distance2Wall );

sLattice.defineU( superGeometry, 3, poiseuilleU );

sLattice.setProcessingContext<Array<momenta::FixedVelocityMomentumGeneric::VELOCITY>>(
  ProcessingContext::Simulation);

} }

// Computes the pressure drop between the voxels before and after the cylinder void getResults( SuperLattice<T, DESCRIPTOR>& sLattice, UnitConverter<T, DESCRIPTOR> const& converter, std::size_t iT, SuperGeometry<T,2>& superGeometry, util::Timer& timer ) { OstreamManager clout( std::cout,"getResults" );

// Gnuplot constructor (must be static!) // for real-time plotting: gplot("name", true) // experimental! static Gnuplot gplot( "drag" );

SuperVTMwriter2D vtmWriter( "cylinder2d" ); SuperLatticePhysVelocity2D<T, DESCRIPTOR> velocity( sLattice, converter ); SuperLatticePhysPressure2D<T, DESCRIPTOR> pressure( sLattice, converter ); SuperLatticeGeometry2D<T, DESCRIPTOR> materials( sLattice, superGeometry ); SuperLatticeRefinementMetricKnudsen2D<T, DESCRIPTOR> quality( sLattice, converter); SuperRoundingF2D roundedQuality ( quality, RoundingMode::NearestInteger); SuperDiscretizationF2D discretization ( roundedQuality, 0., 2. );

vtmWriter.addFunctor( materials ); vtmWriter.addFunctor( quality ); vtmWriter.addFunctor( velocity ); vtmWriter.addFunctor( pressure );

const int vtkIter = converter.getLatticeTime( .3 ); const int statIter = converter.getLatticeTime( .1 );

T point[2] = {}; point[0] = centerCylinderX + 3*radiusCylinder; point[1] = centerCylinderY; AnalyticalFfromSuperF2D intpolateP( pressure, true ); T p; intpolateP( &p,point );

if ( iT == 0 ) { // Writes the geometry, cuboid no. and rank no. as vti file for visualization SuperLatticeGeometry2D<T, DESCRIPTOR> geometry( sLattice, superGeometry ); SuperLatticeCuboid2D<T, DESCRIPTOR> cuboid( sLattice ); SuperLatticeRank2D<T, DESCRIPTOR> rank( sLattice ); vtmWriter.write( geometry ); vtmWriter.write( cuboid ); vtmWriter.write( rank );

vtmWriter.createMasterFile();

}

if ( iT%statIter == 0 ) { sLattice.setProcessingContext(ProcessingContext::Evaluation);

// Timer console output
timer.update( iT );
timer.printStep();

// Lattice statistics console output
sLattice.getStatistics().print( iT,converter.getPhysTime( iT ) );

// Drag, lift, pressure drop
AnalyticalFfromSuperF2D<T> intpolatePressure( pressure, true );
SuperLatticePhysDrag2D<T,DESCRIPTOR> drag( sLattice, superGeometry, 5, converter );

T point1[2] = {};
T point2[2] = {};

point1[0] = centerCylinderX - radiusCylinder;
point1[1] = centerCylinderY;

point2[0] = centerCylinderX + radiusCylinder;
point2[1] = centerCylinderY;

T p1, p2;
intpolatePressure( &p1,point1 );
intpolatePressure( &p2,point2 );

clout << "pressure1=" << p1;
clout << "; pressure2=" << p2;

T pressureDrop = p1-p2;
clout << "; pressureDrop=" << pressureDrop;

int input[3] = {};
T _drag[drag.getTargetDim()];
drag( _drag,input );
clout << "; drag=" << _drag[0] << "; lift=" << _drag[1] << std::endl;

// set data for gnuplot: input={xValue, yValue(s), names (optional), position of key (optional)}
gplot.setData( converter.getPhysTime( iT ), {_drag[0], 5.58}, {"drag(openLB)", "drag(schaeferTurek)"}, "bottom right", {'l','l'} );

// every (iT%vtkIter) write an png of the plot
if ( iT%( vtkIter ) == 0 ) {
  // writes pngs: input={name of the files (optional), x range for the plot (optional)}
  gplot.writePNG( iT, maxPhysT );
}

}

// Writes the vtk files if ( iT%vtkIter == 0 && iT > 0 ) { vtmWriter.write( iT );

{
  SuperEuklidNorm2D<T, DESCRIPTOR> normVel( velocity );
  BlockReduction2D2D<T> planeReduction( normVel, 600, BlockDataSyncMode::ReduceOnly );
  // write output as JPEG
  heatmap::write(planeReduction, iT);
}
{
  BlockReduction2D2D<T> planeReduction( discretization, 600, BlockDataSyncMode::ReduceOnly );
  heatmap::plotParam<T> jpeg_scale;
  jpeg_scale.name = "quality";
  jpeg_scale.colour = "blackbody";
  heatmap::write( planeReduction, iT, jpeg_scale );
}

}

// write pdf at last time step if ( iT == converter.getLatticeTime( maxPhysT )-1 ) { // writes pdf gplot.writePDF(); } }

int main( int argc, char* argv[] ) { // === 1st Step: Initialization === olbInit( &argc, &argv ); singleton::directories().setOutputDir( "./tmp/" ); OstreamManager clout( std::cout,"main" );

UnitConverterFromResolutionAndRelaxationTime<T, DESCRIPTOR> const converter( int {N}, // resolution: number of voxels per charPhysL (T) 0.56, // latticeRelaxationTime: relaxation time, have to be greater than 0.5! (T) 2.0radiusCylinder, // charPhysLength: reference length of simulation geometry (T) 0.2, // charPhysVelocity: maximal/highest expected velocity during simulation in m / s (T) 0.22.*radiusCylinder/Re, // physViscosity: physical kinematic viscosity in m^2 / s (T) 1.0 // physDensity: physical density in kg / m^3 ); // Prints the converter log as console output converter.print(); // Writes the converter log in a file converter.write("cylinder2d");

// === 2rd Step: Prepare Geometry === Vector<T,2> extend( lengthX,lengthY ); Vector<T,2> origin; IndicatorCuboid2D cuboid( extend, origin );

// Instantiation of a cuboidGeometry with weights

ifdef PARALLEL_MODE_MPI

const int noOfCuboids = singleton::mpi().getSize();

else

const int noOfCuboids = 7;

endif

CuboidGeometry2D cuboidGeometry( cuboid, L, noOfCuboids );

// Instantiation of a loadBalancer HeuristicLoadBalancer loadBalancer( cuboidGeometry );

// Instantiation of a superGeometry SuperGeometry<T,2> superGeometry( cuboidGeometry, loadBalancer );

Vector<T,2> center( centerCylinderX,centerCylinderY ); std::shared_ptr<IndicatorF2D> circle = std::make_shared<IndicatorCircle2D>( center, radiusCylinder );

prepareGeometry( converter, superGeometry, circle );

// === 3rd Step: Prepare Lattice === SuperLattice<T, DESCRIPTOR> sLattice( superGeometry );

//prepareLattice and set boundaryConditions prepareLattice( sLattice, converter, superGeometry, circle );

// === 4th Step: Main Loop with Timer === clout << "starting simulation..." << std::endl; util::Timer timer( converter.getLatticeTime( maxPhysT ), superGeometry.getStatistics().getNvoxel() ); timer.start();

for ( std::size_t iT = 0; iT < converter.getLatticeTime( maxPhysT ); ++iT ) { // === 5th Step: Definition of Initial and Boundary Conditions === setBoundaryValues( sLattice, converter, iT, superGeometry );

// === 6th Step: Collide and Stream Execution ===
sLattice.collideAndStream();

// === 7th Step: Computation and Output of the Results ===
getResults( sLattice, converter, iT, superGeometry, timer );

}

timer.stop(); timer.printSummary(); }

atanuchaudhury commented 8 months ago

There are two such files

include <core/core2D.h>

include <boundary/boundary2D.h>

include <communication/communication.h>

include

include <dynamics/dynamics2D.h>

include <reaction/reaction2D.h>

include <functors/functors2D.h>

include <geometry/geometry2D.h>

include <io/io2D.h>

include <solver/solver.h>

include <optimization/opti2D.h>

include <utilities/utilities2D.h>

include <particles/particles.h>

and

include <core/core2D.hh>

include <boundary/boundary2D.hh>

include <communication/communication.hh>

include <dynamics/dynamics2D.hh>

include <reaction/reaction2D.hh>

include <functors/functors2D.hh>

include <geometry/geometry2D.hh>

include <io/io2D.hh>

include <solver/solver.hh>

include <optimization/opti2D.hh>

include <utilities/utilities2D.hh>

include <particles/particles.hh>

AstroSuro commented 8 months ago

The way you have shared is one of the most unprofessional and non-technical methods to share files and your runs. It's extremely difficult to understand and replicate the issue. Kindly be serious and professional when you share code in future.

atanuchaudhury commented 8 months ago

nvcc Giving out the same error.

AstroSuro commented 8 months ago

Is olb2D.h a user-defined header file or system-defined header file? Provide me access to your WSL system. Type the following ip addr show

atanuchaudhury commented 8 months ago

Its not pre existing, I think its user defined headerfile

atanuchaudhury commented 8 months ago

They made this header file by defining some header files of C++.

AstroSuro commented 8 months ago

Follow the given steps:

  1. sudo apt update && sudo apt install openssh-server
  2. sudo nano /etc/ssh/sshd_config
  3. PermitRootLogin no PasswordAuthentication yes
  4. sudo service ssh start
  5. ip addr show
atanuchaudhury commented 7 months ago

Added the files. Please have a look.