nvidia-smi
Friday, October 26, 2012
Wednesday, July 18, 2012
GCC C++ Linker errors: Undefined reference to 'vtable for XXX', Undefined reference to 'ClassName::ClassName()'
(From Stack Overflow)
Answer:
Answer:
Assuming those methods are in one of the libs it looks like an ordering problem.
When linking libraries into an executable they are done in the order they are declared.
Also the linker will only take the methods/functions required to resolve currently oustanding dependencies. If a subsequent library then uses methods/functions that were not originally required by the objects you will have missing dependencies.
How it works:
Objects requires:
But if I linki the application like this:
When linking libraries into an executable they are done in the order they are declared.
Also the linker will only take the methods/functions required to resolve currently oustanding dependencies. If a subsequent library then uses methods/functions that were not originally required by the objects you will have missing dependencies.
How it works:
- Take all the object files and combine them into an executable
- Resolve any dependecies among object files.
- Foreach library in order:
- Check unresolved dependencies and see if the lib resolves them.
- If so load required part into the executable.
Objects requires:
- Open
- Close
- BatchRead
- BatchWrite
- Open
- Close
- read
- write
- BatchRead (but uses lib1:read)
- BatchWrite (but uses lib1:write)
gcc -o plop plop.o -l1 -l2Then the linker will fail to resolve the read and write symbols.
But if I linki the application like this:
gcc -o plop plop.o -l2 -l1Then it will link correctly. As l2 resolves the BatchRead and BatchWrite dependencies but also adds two new ones (read and write). When we link with l1 next all four dependencies are resolved.
Monday, July 16, 2012
Patch metis-4.0 error: conflicting types for __log2
Origin post found here: http://leembong.blogspot.com/2012/02/how-to-patch-metis-40-error-conflicting.html#!/2012/02/how-to-patch-metis-40-error-conflicting.html
METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes, and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes. I give a patch for metis-4.0 software, compilation fails with gcc 4.4.x
make a patch file:
--------------------- metis-4.0.patch--------------------
command:
METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes, and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes. I give a patch for metis-4.0 software, compilation fails with gcc 4.4.x
make a patch file:
--------------------- metis-4.0.patch--------------------
diff -rupN metis-4.0/Lib/kmetis.c metis-4.0.NEW/Lib/kmetis.c
--- metis-4.0/Lib/kmetis.c 1998-11-30 17:26:47.000000000 +0100
+++ metis-4.0.NEW/Lib/kmetis.c 2010-04-29 17:49:55.000000000 +0200
@@ -66,7 +66,7 @@ void METIS_WPartGraphKway(int *nvtxs, id
ctrl.dbglvl = options[OPTION_DBGLVL];
}
ctrl.optype = OP_KMETIS;
- ctrl.CoarsenTo = amax((*nvtxs)/(40*log2(*nparts)), 20*(*nparts));
+ ctrl.CoarsenTo = amax((*nvtxs)/(40*log2_function(*nparts)), 20*(*nparts));
ctrl.maxvwgt = 1.5*((graph.vwgt ? idxsum(*nvtxs, graph.vwgt) : (*nvtxs))/ctrl.CoarsenTo);
InitRandom(-1);
diff -rupN metis-4.0/Lib/kvmetis.c metis-4.0.NEW/Lib/kvmetis.c
--- metis-4.0/Lib/kvmetis.c 1998-11-30 17:26:47.000000000 +0100
+++ metis-4.0.NEW/Lib/kvmetis.c 2010-04-29 17:49:55.000000000 +0200
@@ -66,7 +66,7 @@ void METIS_WPartGraphVKway(int *nvtxs, i
ctrl.dbglvl = options[OPTION_DBGLVL];
}
ctrl.optype = OP_KVMETIS;
- ctrl.CoarsenTo = amax((*nvtxs)/(40*log2(*nparts)), 20*(*nparts));
+ ctrl.CoarsenTo = amax((*nvtxs)/(40*log2_function(*nparts)), 20*(*nparts));
ctrl.maxvwgt = 1.5*((graph.vwgt ? idxsum(*nvtxs, graph.vwgt) : (*nvtxs))/ctrl.CoarsenTo);
InitRandom(-1);
diff -rupN metis-4.0/Lib/mkmetis.c metis-4.0.NEW/Lib/mkmetis.c
--- metis-4.0/Lib/mkmetis.c 1998-11-30 17:26:48.000000000 +0100
+++ metis-4.0.NEW/Lib/mkmetis.c 2010-04-29 17:49:55.000000000 +0200
@@ -47,7 +47,7 @@ void METIS_mCPartGraphKway(int *nvtxs, i
ctrl.dbglvl = options[OPTION_DBGLVL];
}
ctrl.optype = OP_KMETIS;
- ctrl.CoarsenTo = amax((*nvtxs)/(20*log2(*nparts)), 30*(*nparts));
+ ctrl.CoarsenTo = amax((*nvtxs)/(20*log2_function(*nparts)), 30*(*nparts));
ctrl.nmaxvwgt = 1.5/(1.0*ctrl.CoarsenTo);
diff -rupN metis-4.0/Lib/proto.h metis-4.0.NEW/Lib/proto.h
--- metis-4.0/Lib/proto.h 1998-11-30 17:26:50.000000000 +0100
+++ metis-4.0.NEW/Lib/proto.h 2010-04-29 17:49:55.000000000 +0200
@@ -459,7 +459,7 @@ double drand48();
void srand48(long);
int ispow2(int);
void InitRandom(int);
-int log2(int);
+int log2_function(int);
diff -rupN metis-4.0/Lib/rename.h metis-4.0.NEW/Lib/rename.h
--- metis-4.0/Lib/rename.h 1998-11-30 17:26:50.000000000 +0100
+++ metis-4.0.NEW/Lib/rename.h 2010-04-29 17:49:55.000000000 +0200
@@ -410,7 +410,8 @@
#define RandomPermute __RandomPermute
#define ispow2 __ispow2
#define InitRandom __InitRandom
-#define log2 __log2
+/* Correction bug Nadir SOUALEM*/
+#define log2_function __log2_function
diff -rupN metis-4.0/Lib/util.c metis-4.0.NEW/Lib/util.c
--- metis-4.0/Lib/util.c 1998-11-30 17:26:50.000000000 +0100
+++ metis-4.0.NEW/Lib/util.c 2010-04-29 17:49:55.000000000 +0200
@@ -507,9 +507,9 @@ void InitRandom(int seed)
}
/*************************************************************************
-* This function returns the log2(x)
+* This function returns the log2_function(x)
**************************************************************************/
-int log2(int a)
+int log2_function(int a)
{
int i;
----------------------------------------------------------------------
command:
nsoualem@gold: -> cd metis-4.0
nsoualem@gold: -> patch -p1 < metis-4.0.patch
Friday, July 13, 2012
Thursday, June 14, 2012
Compile Boost with cxx flags
sh ./bootstrap.sh
sudo ./b2 install --build-type=complete --layout=tagged cxxflags=-fPIC
sudo ./b2 install --build-type=complete --layout=tagged cxxflags=-fPIC
Switching GCC version
aptitude install gcc-4.4 g++-4.4
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 10
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 10
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 10
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 10
Saturday, June 9, 2012
Bug due to inherentance
1. Derived class call base class function A which call base class's other functions B
The program will go to derived class if B is reimplemented.
The program will go to derived class if B is reimplemented.
Debug MPI
For small number of processes
Valgrind
mpiexec -n 8 valgrind --log-file=valgrind-%p.txt <program and args>
Xterm+GDB
mpiexec -np 3 xterm -e gdb <program to debug without args>
in GDB r <args Here>
Valgrind
mpiexec -n 8 valgrind --log-file=valgrind-%p.txt <program and args>
Xterm+GDB
mpiexec -np 3 xterm -e gdb <program to debug without args>
in GDB r <args Here>
Thursday, May 17, 2012
Install lastest nvidia driver on ubuntu
sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
Subscribe to:
Posts (Atom)