Message: Disaster in CLHEP::RandGauss - thread related? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Disaster in CLHEP::RandGauss - thread related? 

Forum: Installation and Configuration
Date: 05 Jun, 2015
From: Tom Roberts <Tom Roberts>

This is Windows 7 using CMAKE 3.2.1 and Visual Studio 2013 (VC++ 12). This is geant4.10.01.p01. All tools are 32-bits (needed because ultimately I will link with Root).

I'm reporting this in "installation and configuration" because this is clearly a configuration problem. On my Mac this runs correctly (Mac OS X 9.5, cmake 2.8.12.2, and g++ 4.2.1, via Makefile).

I built Geant4 using CMake and VisualStudio, in Debug mode, taking all the defaults (i.e. shared libraries and the internal version of CLHEP). I found no option for threads.

This trivial program crashes after printing "A" only:
//      RandGaussTest.cc
#include <stdio.h>
#include "Randomize.hh"
int main()
{
        fprintf(stderr,"A\n");
        CLHEP::RandGauss::setFlag(false);
        fprintf(stderr,"B\n");
        return 0;
}

I built it using the same tools and this trivial CMakeLists.txt:
  cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
  project(RandGaussTest)
  find_package(Geant4 REQUIRED)
  include(${Geant4_USE_FILE})
  add_executable(RandGaussTest RandGaussTest.cc)
  target_link_libraries(RandGaussTest ${Geant4_LIBRARIES})

After doing Cmake and build (Debug mode), I of course had to copy *.dll from the Geant4/bin directory into the Debug directory where the .exe is located.

The only thing I can think of is that CLHEP::RandGauss::setFlag() references this variable:
    static CLHEP_THREAD_LOCAL bool set_st;

Is there some problem with CLHEP_THREAD_LOCAL ??? How do I fix this?

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Disaster in CLHEP::RandGauss - thread related?   (Tom Roberts - 05 Jun, 2015)
2 Warning: Re: Disaster in CLHEP::RandGauss - thread related?   (Michael H. Kelsey - 05 Jun, 2015)
1 None: Re: Disaster in CLHEP::RandGauss - thread related?   (Tom Roberts - 05 Jun, 2015)
1 None: Re: Disaster in CLHEP::RandGauss - thread related?   (Tom Roberts - 05 Jun, 2015)
2 None: Re: Disaster in CLHEP::RandGauss - thread related?   (Mike Kelsey - 05 Jun, 2015)
... 5 Message(s)
 Add Message Add Message
to: "Disaster in CLHEP::RandGauss - thread related?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]