void Ndb::releaseSignalsInList(NdbApiSignal** pList){ NdbApiSignal* tmp; while (*pList != NULL){ tmp = *pList; *pList = (*pList)->next(); releaseSignal(tmp); } }
void BigArray<T>::loadNC(const std::string &fileName) { dataFileName = fileName; connection.disconnect(); connection = releaseSignal().connect(boost::bind(&gurls::BigArray<T>::close, this)); std::string errorString = "Error opening file " + fileName + ":"; // Set up file access property list with parallel I/O access plist_id = H5Pcreate(H5P_FILE_ACCESS); if(plist_id == -1) throw gException(errorString); herr_t status; #ifdef USE_MPIIO status = H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPI_INFO_NULL); #else status = H5Pset_fapl_mpiposix(plist_id, MPI_COMM_WORLD, false); #endif CHECK_HDF5_ERR(status, errorString) // Create a new file collectively and release property list identifier. file_id = H5Fopen(fileName.c_str(), H5F_ACC_RDWR, plist_id); CHECK_HDF5_ERR(file_id, errorString) status = H5Pclose(plist_id); CHECK_HDF5_ERR(status, errorString) dset_id = H5Dopen(file_id, "mat", H5P_DEFAULT); CHECK_HDF5_ERR(dset_id, errorString) hid_t filespace = H5Dget_space( dset_id ); CHECK_HDF5_ERR(filespace, errorString) hsize_t dims[2], maxDims[2]; status = H5Sget_simple_extent_dims(filespace, dims, maxDims); CHECK_HDF5_ERR(status, errorString) status = H5Sclose(filespace); CHECK_HDF5_ERR(status, errorString) this->numrows = static_cast<unsigned long>(dims[1]); this->numcols = static_cast<unsigned long>(dims[0]); // Create property list for collective dataset write. plist_id = H5Pcreate(H5P_DATASET_XFER); if(plist_id == -1) throw gException(errorString); status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_INDEPENDENT); CHECK_HDF5_ERR(status, errorString) }
void BigArray<T>::init(std::string& fileName, unsigned long r, unsigned long c) { dataFileName = fileName; connection.disconnect(); connection = releaseSignal().connect(boost::bind(&gurls::BigArray<T>::close, this)); std::string errorString = "Error creating file " + fileName + ":"; // Set up file access property list with parallel I/O access plist_id = H5Pcreate(H5P_FILE_ACCESS); if(plist_id == -1) throw gException(errorString); herr_t status; #ifdef USE_MPIIO status = H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPI_INFO_NULL); #else status = H5Pset_fapl_mpiposix(plist_id, MPI_COMM_WORLD, false); #endif CHECK_HDF5_ERR(status, errorString) // Create a new file collectively and release property list identifier. file_id = H5Fcreate(fileName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, plist_id); CHECK_HDF5_ERR(file_id, errorString) status = H5Pclose(plist_id); CHECK_HDF5_ERR(status, errorString) // Create the dataspace for the dataset. hsize_t dims[2]; dims[0] = static_cast<hsize_t>(c); dims[1] = static_cast<hsize_t>(r); hid_t filespace = H5Screate_simple(2, dims, NULL); CHECK_HDF5_ERR(filespace, errorString) hid_t plist_dset_id = H5Pcreate(H5P_DATASET_CREATE); if(plist_dset_id == -1) throw gException(errorString); dset_id = H5Dcreate(file_id, "mat", getHdfType<T>(), filespace, H5P_DEFAULT, plist_dset_id, H5P_DEFAULT); CHECK_HDF5_ERR(dset_id, errorString) status = H5Pclose(plist_dset_id); CHECK_HDF5_ERR(status, errorString) status = H5Sclose(filespace); CHECK_HDF5_ERR(status, errorString) this->numrows = r; this->numcols = c; // Create property list for collective dataset write. plist_id = H5Pcreate(H5P_DATASET_XFER); if(plist_id == -1) throw gException(errorString); status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_INDEPENDENT); CHECK_HDF5_ERR(status, errorString) flush(); }
LogManager::~LogManager() { releaseSignal(*this); }
/****************************************************************************** * int init( int aNrOfCon, int aNrOfOp ); * * Return Value: Return 0 : init was successful. * Return -1: In all other case. * Parameters: aNrOfCon : Number of connections offered to the application. * aNrOfOp : Number of operations offered to the application. * Remark: Create pointers and idle list Synchronous. ****************************************************************************/ int Ndb::init(int aMaxNoOfTransactions) { DBUG_ENTER("Ndb::init"); int i; int aNrOfCon; int aNrOfOp; int tMaxNoOfTransactions; NdbApiSignal* tSignal[16]; // Initiate free list of 16 signal objects if (theInitState != NotInitialised) { switch(theInitState){ case InitConfigError: theError.code = 4117; break; default: theError.code = 4104; break; } DBUG_RETURN(-1); }//if theInitState = StartingInit; TransporterFacade * theFacade = theImpl->m_transporter_facade; theEventBuffer->m_mutex = theFacade->theMutexPtr; const Uint32 tRef = theImpl->open(theFacade); if (tRef == 0) { theError.code = 4105; DBUG_RETURN(-1); // no more free blocknumbers }//if Uint32 nodeId = refToNode(tRef); theNdbBlockNumber = refToBlock(tRef); if (nodeId > 0) { connected(Uint32(tRef)); } /* Init cached min node version */ theFacade->lock_mutex(); theCachedMinDbNodeVersion = theFacade->getMinDbNodeVersion(); theFacade->unlock_mutex(); theDictionary->setTransporter(this, theFacade); aNrOfCon = theImpl->theNoOfDBnodes; aNrOfOp = 2*theImpl->theNoOfDBnodes; // Create connection object in a linked list if((createConIdleList(aNrOfCon)) == -1){ theError.code = 4000; goto error_handler; } // Create operations in a linked list if((createOpIdleList(aNrOfOp)) == -1){ theError.code = 4000; goto error_handler; } tMaxNoOfTransactions = aMaxNoOfTransactions; theMaxNoOfTransactions = tMaxNoOfTransactions; theRemainingStartTransactions= tMaxNoOfTransactions; thePreparedTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions]; theSentTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions]; theCompletedTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions]; if ((thePreparedTransactionsArray == NULL) || (theSentTransactionsArray == NULL) || (theCompletedTransactionsArray == NULL)) { goto error_handler; }//if for (i = 0; i < tMaxNoOfTransactions; i++) { thePreparedTransactionsArray[i] = NULL; theSentTransactionsArray[i] = NULL; theCompletedTransactionsArray[i] = NULL; }//for for (i = 0; i < 16; i++){ tSignal[i] = getSignal(); if(tSignal[i] == NULL) { theError.code = 4000; goto error_handler; } } for (i = 0; i < 16; i++) releaseSignal(tSignal[i]); theInitState = Initialised; DBUG_RETURN(0); error_handler: ndbout << "error_handler" << endl; releaseTransactionArrays(); delete theDictionary; theImpl->close(); DBUG_RETURN(-1); }