← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1825: 1. Add chunkSize option that determines how many plugins will be compiled together. (orthogonal t...

 

------------------------------------------------------------
revno: 1825
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Mon 2009-11-30 09:48:32 +0100
message:
  1. Add chunkSize option that determines how many plugins will be compiled together. (orthogonal to linkStrategy, that one determines how many will be linked to together). Should avoid issue with monolithic link on machines with less RAM; allows parallel compilation of plugins on machines with lots of RAM. Defaults to 20.
  1. Re-enable crash warning in pyboot.cpp
modified:
  SConstruct
  core/main/pyboot.cpp
  py/yadeWrapper/yadeWrapper.cpp
  yadeSCons.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'SConstruct'
--- SConstruct	2009-11-29 11:03:25 +0000
+++ SConstruct	2009-11-30 08:48:32 +0000
@@ -143,6 +143,7 @@
 	#('extraModules', 'Extra directories with their own SConscript files (must be in-tree) (whitespace separated)',None,None,Split),
 	('buildPrefix','Where to create build-[version][variant] directory for intermediary files','..'),
 	EnumVariable('linkStrategy','How to link plugins together',defOptions['linkStrategy'],['per-class','per-pkg[broken]','monolithic','static[broken]']),
+	('chunkSize','Maximum files to compile in one translation unit when building plugins.',20,None,int),
 	('version','Yade version (if not specified, guess will be attempted)',None),
 	('CPPPATH', 'Additional paths for the C preprocessor (colon-separated)','/usr/include/vtk-5.2:/usr/include/vtk-5.4'),
 	('LIBPATH','Additional paths for the linker (colon-separated)',None),
@@ -558,7 +559,7 @@
 	ret=set()
 	for p in plugins:
 		if not buildPlugs.has_key(p):
-			raise RuntimeError("Plugin %s will not be built!"%p)
+			raise RuntimeError("Plugin %s is required (backtrace shows where), but will not be built!"%p)
 		ret.add(buildPlugs[p].obj)
 	return ['core','yade-support']+list(ret)
 

=== modified file 'core/main/pyboot.cpp'
--- core/main/pyboot.cpp	2009-11-30 07:47:26 +0000
+++ core/main/pyboot.cpp	2009-11-30 08:48:32 +0000
@@ -3,12 +3,17 @@
 
 #include<signal.h>
 #include<cstdlib>
+#include<cstdio>
 #include<iostream>
 #include<string>
 #include<stdexcept>
 
 #include<boost/python.hpp>
 
+#ifdef YADE_LOG4CXX
+	log4cxx::LoggerPtr logger=log4cxx::Logger::getLogger("yade.python");
+#endif
+
 #ifdef YADE_DEBUG
 	void crashHandler(int sig){
 	switch(sig){
@@ -38,7 +43,12 @@
 	#endif
 
 	#if defined(YADE_OPENMP) || defined(YADE_OPENGL)
-		//LOG_ERROR("Yade compiled with openmp/opengl. Using python main will likely crash as soone as an ostream is used.")
+		#ifdef LOG4CXX
+			LOG_ERROR("Yade compiled with openmp/opengl. Using python main will likely crash as soone as an ostream is used.")
+		#else
+			// avoid log4cxx-less LOG_ERROR, since it uses cerr, which crashes due to libsctc++ (?) issue.
+			fprintf(stderr,"ERROR: Yade compiled with openmp/opengl. Using python main will likely crash as soone as an ostream is used.\n");
+		#endif
 	#endif
 
 	PyEval_InitThreads();

=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2009-11-29 15:46:19 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2009-11-30 08:48:32 +0000
@@ -38,11 +38,6 @@
 #include<yade/core/EngineUnit.hpp>
 
 #include<yade/pkg-common/BoundingVolumeMetaEngine.hpp>
-#ifdef YADE_SHAPE
-	#include<yade/pkg-common/GeometricalModelMetaEngine.hpp>
-	#include<yade/pkg-common/InteractingGeometryMetaEngine.hpp>
-	#include<yade/pkg-common/GeometricalModelEngineUnit.hpp>
-#endif
 #include<yade/pkg-common/InteractionGeometryMetaEngine.hpp>
 #include<yade/pkg-common/InteractionPhysicsMetaEngine.hpp>
 #include<yade/pkg-common/ConstitutiveLawDispatcher.hpp>
@@ -821,10 +816,6 @@
 
 	#define EXPOSE_DISPATCHER(DispatcherT,functorT) python::class_<DispatcherT, shared_ptr<DispatcherT>, python::bases<MetaEngine>, noncopyable >(#DispatcherT).def("__init__",python::make_constructor(Dispatcher_ctor_list<DispatcherT,functorT>)).add_property("functors",&Dispatcher_functors_get<DispatcherT,functorT>).def("dump",&DispatcherT::dump);
 		EXPOSE_DISPATCHER(BoundingVolumeMetaEngine,BoundingVolumeEngineUnit)
-		#ifdef YADE_SHAPE
-			EXPOSE_DISPATCHER(GeometricalModelMetaEngine,GeometricalModelEngineUnit)
-			EXPOSE_DISPATCHER(InteractingGeometryMetaEngine,InteractingGeometryEngineUnit)
-		#endif
 		EXPOSE_DISPATCHER(InteractionGeometryMetaEngine,InteractionGeometryEngineUnit)
 		EXPOSE_DISPATCHER(InteractionPhysicsMetaEngine,InteractionPhysicsEngineUnit)
 		#ifdef YADE_PHYSPAR
@@ -837,10 +828,6 @@
 
 	#define EXPOSE_FUNCTOR(FunctorT) python::class_<FunctorT, shared_ptr<FunctorT>, python::bases<EngineUnit>, noncopyable>(#FunctorT).def("__init__",python::raw_constructor(Serializable_ctor_kwAttrs<FunctorT>));
 		EXPOSE_FUNCTOR(BoundingVolumeEngineUnit)
-		#ifdef YADE_SHAPE
-			EXPOSE_FUNCTOR(GeometricalModelEngineUnit)
-			EXPOSE_FUNCTOR(InteractingGeometryEngineUnit)
-		#endif
 		EXPOSE_FUNCTOR(InteractionGeometryEngineUnit)
 		EXPOSE_FUNCTOR(InteractionPhysicsEngineUnit)
 		#ifdef YADE_PHYSPAR
@@ -857,9 +844,6 @@
 	#define EXPOSE_CXX_CLASS_IX(className) EXPOSE_CXX_CLASS(className).add_property("classIndex",&Indexable_getClassIndex<className>)
 
 	EXPOSE_CXX_CLASS(Body)
-		#ifdef YADE_SHAPE
-			.def_readwrite("shape",&Body::geometricalModel)
-		#endif
 		.def_readwrite("mold",&Body::interactingGeometry)
 		.def_readwrite("bound",&Body::boundingVolume)
 		.def_readwrite("mat",&Body::material)
@@ -871,9 +855,6 @@
 		.add_property("isClumpMember",&Body::isClumpMember)
 		.add_property("isClump",&Body::isClump);
 	EXPOSE_CXX_CLASS_IX(InteractingGeometry);
-	#ifdef YADE_SHAPE
-		EXPOSE_CXX_CLASS_IX(GeometricalModel);
-	#endif
 	EXPOSE_CXX_CLASS_IX(BoundingVolume)
 		.def_readonly("min",&BoundingVolume::min)
 		.def_readonly("max",&BoundingVolume::max);

=== modified file 'yadeSCons.py'
--- yadeSCons.py	2009-11-29 11:03:25 +0000
+++ yadeSCons.py	2009-11-30 08:48:32 +0000
@@ -135,16 +135,23 @@
 	ret.discard(p.obj)
 	return ret
 
+def seqChunks(l,n):
+    return [l[i:i+n] for i in range(0, len(l), n)]
+
 def buildPluginLibs(env,plugInfo):
 	objs={}
 	linkStrategy=env['linkStrategy']
+	chunkSize=env['chunkSize']
 	for p in plugInfo.values():
 		if not objs.has_key(p.obj): objs[p.obj]=(set(),set())
 		objs[p.obj][0].add(p.src)
 		objs[p.obj][1].update(p.libs)
 	for obj in objs.keys():
 		srcs=list(objs[obj][0])
-		if len(srcs)>1: srcs=env.Combine('$buildDir/'+obj+'.cpp',srcs)
+		if len(srcs)>1:
+			if len(srcs)<chunkSize: srcs=env.Combine('$buildDir/'+obj+'.cpp',srcs)
+			# thanks to http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python :
+			else: srcs=[env.Combine('$buildDir/'+obj+'%d.cpp'%i,srcs[i:i+chunkSize]) for i in range(0,len(srcs),chunkSize)]
 		if linkStrategy!='static':
 			env.Install('$PREFIX/lib/yade$SUFFIX/plugins',env.SharedLibrary(obj,srcs,LIBS=env['LIBS']+['yade-support','core']+list(objs[obj][1])))
 		else:


Follow ups