Jump to content

mtmaps (OpenMP)


Recommended Posts

Uptime ? ~3 hours, online players ? ~3000.

But you need include OMP, and i don't know if it's work with ACE mtmaps, but i can create a little patch for ACE if you want.

I have just add that :

   #pragma omp critical(spellLock)
   {
       m_Events.Update( p_time );
       _UpdateSpells( p_time );
   }

Link to comment
Share on other sites

  • Replies 319
  • Created
  • Last Reply

Top Posters In This Topic

Uptime ? ~3 hours, online players ? ~3000.

But you need include OMP, and i don't know if it's work with ACE mtmaps, but i can create a little patch for ACE if you want.

I have just add that :

   #pragma omp critical(spellLock)
   {
       m_Events.Update( p_time );
       _UpdateSpells( p_time );
   }

Yes pls create that patch. And I am very interested why you have chosen OpenMP against ACE? Is it much more stable?

P/S What core rev do you use? Is there any custom patches except MTMAPS?

Best Regards

Thx a lot

Link to comment
Share on other sites

Im testing now it. Btw i have a question about CPU usage , if i use command "top" then the usage is about 50% for the PID of the core , but the average is 7% , so it means that i use 7% of the CPU and take alot of more and i can cross 100% for the PID?

I have quad core

BTW . homuch do i need to set ACEmap thread? i have set it at 1

Link to comment
Share on other sites

commit 9ae413e4a5568c8ccfbf0cdf26510675fa352126

Author: izidor.millenium <[email protected]>

Date: Thu Feb 25 18:26:32 2010 +0100

- ACE multithread map lock for spell update

Signed-off-by: izidor.millenium <[email protected]>

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp

index cbe69fd..1e1a2e9 100644

--- a/src/game/Unit.cpp

+++ b/src/game/Unit.cpp

@@ -310,8 +310,10 @@ void Unit::Update( uint32 p_time )

// WARNING! Order of execution here is important, do not change.

// Spells must be processed with event system BEFORE they go to _UpdateSpells.

// Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.

+ sWorld.m_spellUpdateLock.acquire();

m_Events.Update( p_time );

_UpdateSpells( p_time );

+ sWorld.m_spellUpdateLock.release();

CleanupDeletedAuras();

diff --git a/src/game/World.h b/src/game/World.h

index 8a4b370..961c5bd 100644

--- a/src/game/World.h

+++ b/src/game/World.h

@@ -545,6 +545,7 @@ class World

//used Script version

void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; }

char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); }

+ ACE_Thread_Mutex m_spellUpdateLock;

protected:

void _UpdateGameTime();

It is wrong solution.

+ ACE_Thread_Mutex m_spellUpdateLock;

How much is a instance class World ? = 1.

Then we take the mutex. How many units? - Each player, vehicle, npc.

Each update get mutex, in that time others threads is waiting for the queue. This creates a "bottleneck."

How many maps is the npc? - 1.

Why update was to be made from more than one thread?

Solutions must be sought - mutexs are not needed.

If two threads at once the update (), the problem lies elsewhere. Mutexs do not fix it.

(Sorry for my english)

Link to comment
Share on other sites

Woweur mutex patch is perfectly fine, its a common technique to use global mutexes for protecting non-reentrant code. A better solution would be to use #pragma omp critical section than ACE mutexes, cause #pragma omp critical will work better with rest of omp.

As long for openmp, the problem with it is that on some systems the gcc implementation of openmp specification ( libgomp ) is configured to use linux specific optimizations, that cause high cpu ussage ( busy waiting ) and better performance ofc. But having all CPU on 100% is not good if you use the server for other things except mangos. I think the linux specific optimizations appeared in latest gcc releases, so older systems like the stable debian are still using the posix variant which is a bit slower, but doesnt waste that much cpu.

Link to comment
Share on other sites

anyone got working openmp with gcc 4.4+ ? with gcc 4.4 all threads are on ~100% CPU

and maybe anyone know how to downgrade gcc to 4.2 ubuntu

you can do this, to get gcc 4.2:

apt-get install gcc-4.2

and then to compile with gcc 4.2 you have to set the variable CC:

export CC=gcc-4.2
make -j4

i'm not sure if you already have to set the variable before configure... you'll need to test it.

-- DasBlub

Link to comment
Share on other sites

Does anyone have any solution to the error concurrent_vector ??

/home/bode/source/mangos/objdir/src/game/../../../src/game/../../dep/tbb/include/tbb/concurrent_vector.h:695: undefined reference to `tbb::internal::concurrent_vector_base_v3::internal_capacity() const'

/home/bode/source/mangos/objdir/src/game/../../../src/game/../../dep/tbb/include/tbb/concurrent_vector.h:695: undefined reference to `tbb::internal::concurrent_vector_base_v3::internal_capacity() const'

collect2: ld returned 1 exit status

make[3]: *** [mangos-worldd] Error 1

Link to comment
Share on other sites

So If I get it correct then the best way is to use Infinity's patch with WoWeur's lock for spell update if I want to get the best stability with the 0.12 branch? I don't need the ACE pragma then?

I also got a few conflicts and can't solve two of them one the latest 0.12 branch (397cc2ab0081ef115b27fe5a7b31c3ee2b82e562):

ObjectAccessor.h:

diff a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h    (rejected hunks)
@@ -126,14 +131,16 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
        void RemoveObject(Player *object) { HashMapHolder<Player>::Remove(object); }

        // TODO: This methods will need lock in MT environment
-        static void LinkMap(Map* map)   { i_mapList.push_back(map); }
-        static void DelinkMap(Map* map) { i_mapList.remove(map); }
+        static void LinkMap(Map* map)   { ACE_Guard<ACE_Thread_Mutex> guard(m_Lock); i_mapList.push_back(map); }
+        static void DelinkMap(Map* map) { ACE_Guard<ACE_Thread_Mutex> guard(m_Lock); i_mapList.remove(map); }
    private:
+        static ACE_Thread_Mutex  m_Lock;
        // TODO: This methods will need lock in MT environment
        // Theoreticaly multiple threads can enter and search in this method but
        // in that case linking/delinking other map should be guarded
        template <class OBJECT> static OBJECT* FindHelper(uint64 guid)
        {
+            ACE_Guard<ACE_Thread_Mutex> guard(m_Lock);
            for (std::list<Map*>::const_iterator i = i_mapList.begin() ; i != i_mapList.end(); ++i)
            {
                if (OBJECT* ret = (*i)->GetObjectsStore().find(guid, (OBJECT*)NULL))

I can't find the related code in the ObjectAccessor.h at all.

Spell.cpp:

    // Lookup target in already in list
-    c
+    for(tbb::concurrent_vector<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)

I guess this is also a mistake in the patch and it should be:

     // Lookup target in already in list
-    for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+    for(tbb::concurrent_vector<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)

@@ -3377,7 +3441,7 @@ void Spell::WriteSpellGoTargets( WorldPacket * data )
    // m_needAliveTargetMask req for stop channeling if one target die
    uint32 hit  = m_UniqueGOTargetInfo.size(); // Always hits on GO
    uint32 miss = 0;
-    for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+    for(tbb::concurrent_vector<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
    {
        if ((*ihit).effectMask == 0)                  // No effect apply - all immuned add state
        {

I found the function "WriteSpellGoTargets" but it doesn't fits there at all.

@@ -327,7 +327,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
                    case 72624: case 72625:                 // Ooze Eruption
                    {
                        uint32 count = 0;
-                        for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
+                        for(tbb::concurrent_vector<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
                            if(ihit->effectMask & (1<<effect_idx))
                                ++count;

Only for the Wotlk spell, so quite useless for 0.12 I guess.

Link to comment
Share on other sites

Hello. another problem with a fresh install, sorry.

After the compilation, while packing files :

g++ -g -DMANGOS_DEBUG -DDO_MYSQL -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -m64 -pipe -msse4.2 -DFD_SETSIZE=4096 -fno-delete-null-pointer-checks -fno-strength-reduce -fno-strict-aliasing -frename-registers -o .libs/mangos-worldd CliRunnable.o Main.o Master.o RASocket.o MaNGOSsoap.o WorldRunnable.o soapC.o soapServer.o ../bindings/ScriptDev2/.libs/libmangosscript.so ../game/libmangosgame.a ../shared/Database/libmangosdatabase.a ../shared/Config/libmangosconfig.a ../shared/Auth/libmangosauth.a ../shared/libmangosshared.a ../shared/vmap/libmangosvmaps.a ../framework/libmangosframework.a ../../dep/src/g3dlite/libg3dlite.a ../../dep/src/gsoap/libgsoap.a -lpthread -Wl,--rpath -Wl,/home/mangos/lib

CliRunnable.o: In function `thread_mutex_lock':

/usr/local/include/ace/OS_NS_Thread.inl:3412: undefined reference to `ACE_OS::mutex_lock(pthread_mutex_t*)'

CliRunnable.o: In function `thread_mutex_unlock':

/usr/local/include/ace/OS_NS_Thread.inl:3491: undefined reference to `ACE_OS::mutex_unlock(pthread_mutex_t*)'

CliRunnable.o: In function `~ACE_Atomic_Op':

/usr/local/include/ace/Atomic_Op_T.h:263: undefined reference to `ACE_Thread_Mutex::~ACE_Thread_Mutex()'

/usr/local/include/ace/Atomic_Op_T.h:263: undefined reference to `ACE_Thread_Mutex::~ACE_Thread_Mutex()'

/usr/local/include/ace/Atomic_Op_T.h:263: undefined reference to `ACE_Thread_Mutex::~ACE_Thread_Mutex()'

Undef reference in all ACE function. It is a problem on my side or a new weird rev. from mangos devs ?

thks !

Link to comment
Share on other sites

Does anyone have any solution to the error concurrent_vector ??

/home/bode/source/mangos/objdir/src/game/../../../src/game/../../dep/tbb/include/tbb/concurrent_vector.h:695: undefined reference to `tbb::internal::concurrent_vector_base_v3::internal_capacity() const'

/home/bode/source/mangos/objdir/src/game/../../../src/game/../../dep/tbb/include/tbb/concurrent_vector.h:695: undefined reference to `tbb::internal::concurrent_vector_base_v3::internal_capacity() const'

collect2: ld returned 1 exit status

make[3]: *** [mangos-worldd] Error 1

I have this issue to sadly =[

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use