There's no way to implement this check safely (being non NULL doesn't mean it was properly initialized by the user, it could still point to random memory that would cause a segfault when checking).
If you really need something like this, put an integer value on the side of the topology variable, and make 0 or 1 depending on whether the topology was init or not. Brice ----- Reply message ----- De : "Gabriele Fatigati" <g.fatig...@cineca.it> PourĀ : "Hardware locality user list" <hwloc-us...@open-mpi.org> Objet : [hwloc-users] Re : hwloc topology check initializing Date : sam., sept. 3, 2011 15:26 Hi Brice, but it works only if the user assing NULL to topology. hwloc_topology_init() does not check the argument passed ? There are no ways to check if topology is initialized or not? Thanks. 2011/9/3 Brice Goglin <brice.gog...@inria.fr> > > Assign NULL to the topology when declaring the variable. It will be changed > into something else when init() is called. > > Brice > > ----- Reply message ----- > De : "Gabriele Fatigati" <g.fatig...@cineca.it> > Pour : "Hardware locality user list" <hwloc-us...@open-mpi.org> > Objet : [hwloc-users] hwloc topology check initializing > Date : sam., sept. 3, 2011 10:56 > > > > > Dear hwloc users, > > how to check if my hwloc topology is initialized? I have to use > hwloc_topology_check? This code not works: > > hwloc_topology_t topology; > > if( topology==NULL) > exit(-1); > > > > > > -- > Ing. Gabriele Fatigati > > HPC specialist > > SuperComputing Applications and Innovation Department > > Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy > > www.cineca.it Tel: +39 051 6171722 > > g.fatigati [AT] cineca.it > > _______________________________________________ > hwloc-users mailing list > hwloc-us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users > -- Ing. Gabriele Fatigati HPC specialist SuperComputing Applications and Innovation Department Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy www.cineca.it Tel: +39 051 6171722 g.fatigati [AT] cineca.it