Exemplo n.º 1
0
char* check_absolute_path_icon(char const* app_id, char const* icon_path)
{
    char* icon = NULL;
    if ((icon = _check(app_id)) == NULL) {
        char* basename = get_basename_without_extend_name(icon_path);
        if (basename != NULL) {
            if (g_strcmp0(app_id, basename) == 0
                || (icon = _check(basename)) == NULL)
                icon = g_strdup(icon_path);
            g_free(basename);
        }
    }

    return icon;
}
Exemplo n.º 2
0
void c_galaxysrv_peers::add_peer(unique_ptr<t_peer_reference_newloop> && ref) {
	_check(ref.get());
	_note("Adding peer: "); // TODO << *ref );

	auto peer = make_unique<c_peer_connection>( std::move( *ref ) );
	m_peer.push_back( std::move( peer ) );
}
Exemplo n.º 3
0
//---------------------------------------------------------------------------------------
// Initialize - Config
bool CSirtAlgorithm::initialize(const Config& _cfg)
{
	ASTRA_ASSERT(_cfg.self);
	ConfigStackCheck<CAlgorithm> CC("SirtAlgorithm", this, _cfg);

	// if already initialized, clear first
	if (m_bIsInitialized) {
		clear();
	}

	// initialization of parent class
	if (!CSartAlgorithm::initialize(_cfg)) {
		return false;
	}

	//// init data objects and data projectors
	//_init();

	//// Alpha
	//m_fAlpha = _cfg.self.getOptionNumerical("Alpha", m_fAlpha);
	//CC.markOptionParsed("Alpha");

	// success
	m_bIsInitialized = _check();
	return m_bIsInitialized;
}
Exemplo n.º 4
0
void c_galaxysrv_peers::add_peer_simplestring(const string & simple) {
	_clue("Adding peer from simplestring=" << simple);
	t_peering_reference_parse parse = parse_peer_reference(simple); // partially parsed
	_dbg1("Done the parse itself");
	bool id_anyone=true;
	string id;
	const auto & cables = parse.second;

	auto reference = make_unique<t_peer_reference_newloop>();

	if (parse.first.size()==1) { // there was 1 ID parsed
		_dbg1("There is some ID in that reference.");
		id_anyone=false;
		id = parse.first.at(0);
		reference->hip = c_haship_addr( c_haship_addr::tag_constr_by_addr_dot() , id);
	} else {
		_dbg1("There is NO ID in that reference (anyone?)");
		id_anyone=true;
		_check(parse.first.size() == 0); // else there was no ID parsed
		reference->hip = c_haship_addr::make_empty(); // clear it to be sure
	}
	_note(join_string_sep( id_anyone?"anyone":"id" , id ) );
	_note("Cables: " << cables.size());
	for(const auto & cablestr : cables) {
		_note("Cable: " << cablestr); // cablestr like udp:192.168.1.107:9042
		unique_ptr<c_cable_base_addr> cable_addr = c_cable_base_addr::cable_make_addr( cablestr );
		reference->cable_addr.push_back( std::move(cable_addr) );
	}
	this->add_peer( std::move( reference ) ); // ***
}
Exemplo n.º 5
0
void CudnnLibrary::cudnnGetConvolutionBackwardFilterWorkspaceSize(
                        const cudnnTensorDescriptor_t       xDesc,
                        const cudnnTensorDescriptor_t       dyDesc,
                        const cudnnConvolutionDescriptor_t  convDesc,
                        const cudnnFilterDescriptor_t       gradDesc,
                        cudnnConvolutionBwdFilterAlgo_t     algo,
                        size_t*                             sizeInBytes )
{
    _check();

    auto status = (*_interface.cudnnGetConvolutionBackwardFilterWorkspaceSize)(
        _interface.getHandle(),
        xDesc,
        dyDesc,
        convDesc,
        gradDesc,
        algo,
        sizeInBytes);

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnConvolutionBackwardFilterWorkspaceSize failed: " +
            _interface.getErrorString(status));
    }

}
Exemplo n.º 6
0
void CudnnLibrary::cudnnGetConvolutionBackwardFilterAlgorithm(
                        const cudnnTensorDescriptor_t         xDesc,
                        const cudnnTensorDescriptor_t         dyDesc,
                        const cudnnConvolutionDescriptor_t    convDesc,
                        const cudnnFilterDescriptor_t         dwDesc,
                        cudnnConvolutionBwdFilterPreference_t preference,
                        size_t                                memoryLimitInBytes,
                        cudnnConvolutionBwdFilterAlgo_t*      algo )
{
    _check();

    auto status = (*_interface.cudnnGetConvolutionBackwardFilterAlgorithm)(
        _interface.getHandle(),
        xDesc,
        dyDesc,
        convDesc,
        dwDesc,
        preference,
        memoryLimitInBytes,
        algo);

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnConvolutionBackwardFilterAlgorithm failed: " +
            _interface.getErrorString(status));
    }

}
Exemplo n.º 7
0
//----------------------------------------------------------------------------------------
// Initialize - C++
bool CArtAlgorithm::initialize(CProjector2D* _pProjector, 
							   CFloat32ProjectionData2D* _pSinogram, 
							   CFloat32VolumeData2D* _pReconstruction)
{
	// if already initialized, clear first
	if (m_bIsInitialized) {
		clear();
	}

	// required classes
	m_pProjector = _pProjector;
	m_pSinogram = _pSinogram;
	m_pReconstruction = _pReconstruction;

	// ray order
	m_iCurrentRay = 0;
	m_iRayCount = _pProjector->getProjectionGeometry()->getDetectorCount() * 
		_pProjector->getProjectionGeometry()->getProjectionAngleCount();
	m_piProjectionOrder = new int[m_iRayCount];
	m_piDetectorOrder = new int[m_iRayCount];
	for (int i = 0; i < m_iRayCount; i++) {
		m_piProjectionOrder[i] = (int)floor((float)i / _pProjector->getProjectionGeometry()->getDetectorCount());
		m_piDetectorOrder[i] = i % _pProjector->getProjectionGeometry()->getDetectorCount();
	}

	// success
	m_bIsInitialized = _check();
	return m_bIsInitialized;
}
Exemplo n.º 8
0
void CudnnLibrary::cudnnPoolingBackward(const cudnnPoolingDescriptor_t  poolingDesc,
                                        const void*                     alpha,
                                        const cudnnTensorDescriptor_t   srcDesc,
                                        const void*                     srcData,
                                        const cudnnTensorDescriptor_t   srcDiffDesc,
                                        const void*                     srcDiffData,
                                        const cudnnTensorDescriptor_t   destDesc,
                                        const void*                     destData,
                                        const void*                     beta,
                                        const cudnnTensorDescriptor_t   destDiffDesc,
                                        void*                           destDiffData
                                              )
{
    _check();

    auto status = (*_interface.cudnnPoolingBackward)(_interface.getHandle(),
        poolingDesc,
        alpha,
        srcDesc,
        srcData,
        srcDiffDesc,
        srcDiffData,
        destDesc,
        destData,
        beta,
        destDiffDesc,
        destDiffData
        );

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnPoolingBackward failed: " +
            _interface.getErrorString(status));
    }
}
Exemplo n.º 9
0
void CudnnLibrary::cudnnSetRNNDescriptor(cudnnRNNDescriptor_t rnnDesc,
                                         int hiddenSize,
                                         int numLayers,
                                         cudnnDropoutDescriptor_t dropoutDesc,
                                         cudnnRNNInputMode_t inputMode,
                                         cudnnDirectionMode_t direction,
                                         cudnnRNNMode_t mode,
                                         cudnnDataType_t dataType)
{
    _check();

    auto status = (*_interface.cudnnSetRNNDescriptor)(rnnDesc,
                                                      hiddenSize,
                                                      numLayers,
                                                      dropoutDesc,
                                                      inputMode,
                                                      direction,
                                                      mode,
                                                      dataType);

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnSetRnnDescriptor failed: " +
            _interface.getErrorString(status));
    }
}
Exemplo n.º 10
0
void CudnnLibrary::cudnnGetRNNLinLayerBiasParams(const cudnnRNNDescriptor_t rnnDesc,
                                                 const int layer,
                                                 const cudnnTensorDescriptor_t xDesc,
                                                 const cudnnFilterDescriptor_t wDesc,
                                                 const void* w,
                                                 const int linLayerID,
                                                 cudnnFilterDescriptor_t linLayerBiasDesc,
                                                 void** linLayerBias
                                                 )
{
    _check();

    auto status = (*_interface.cudnnGetRNNLinLayerBiasParams)(_interface.getHandle(),
                                                              rnnDesc,
                                                              layer,
                                                              xDesc,
                                                              wDesc,
                                                              w,
                                                              linLayerID,
                                                              linLayerBiasDesc,
                                                              linLayerBias);

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnGetRNNLinLayerBiasParams failed: " +
            _interface.getErrorString(status));
    }
}
Exemplo n.º 11
0
//---------------------------------------------------------------------------------------
// Initialize, use a Config object
bool CCudaProjector2D::initialize(const Config& _cfg)
{
	assert(_cfg.self);
	ConfigStackCheck<CProjector2D> CC("CudaProjector2D", this, _cfg);

	// if already initialized, clear first
	if (m_bIsInitialized) {
		clear();
	}

	// initialization of parent class
	if (!CProjector2D::initialize(_cfg)) {
		return false;
	}

	// TODO: Check the projection geometry is a supported type

	XMLNode node = _cfg.self.getSingleNode("ProjectionKernel");
	m_projectionKernel = ker2d_default;
	if (node) {
		std::string sProjKernel = node.getContent();

		if (sProjKernel == "default") {

		} else {
			return false;
		}
	}
	CC.markNodeParsed("ProjectionKernel");

	m_bIsInitialized = _check();
	return m_bIsInitialized;
}
Exemplo n.º 12
0
void CudnnLibrary::cudnnConvolutionBackwardFilter(const void*      alpha,
                                const cudnnTensorDescriptor_t      srcDesc,
                                const void*                        srcData,
                                const cudnnTensorDescriptor_t      diffDesc,
                                const void*                        diffData,
                                const cudnnConvolutionDescriptor_t convDesc,
                                cudnnConvolutionBwdFilterAlgo_t    algo,
                                void*                              workSpace,
                                size_t                             workSpaceSizeInBytes,
                                const void*                        beta,
                                const cudnnFilterDescriptor_t      gradDesc,
                                void*                              gradData)
{
    _check();

    auto status = (*_interface.cudnnConvolutionBackwardFilter)(_interface.getHandle(),
        alpha, srcDesc, srcData, diffDesc, diffData, convDesc,
        algo, workSpace, workSpaceSizeInBytes,
        beta, gradDesc, gradData);

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnConvolutionBackwardFilter failed: " +
            _interface.getErrorString(status));
    }
}
Exemplo n.º 13
0
//---------------------------------------------------------------------------------------
// Initialize, use a Config object
bool CCudaProjector3D::initialize(const Config& _cfg)
{
	assert(_cfg.self);
	ConfigStackCheck<CProjector3D> CC("CudaProjector3D", this, _cfg);

	// if already initialized, clear first
	if (m_bIsInitialized) {
		clear();
	}

	// initialization of parent class
	if (!CProjector3D::initialize(_cfg)) {
		return false;
	}

	XMLNode node = _cfg.self.getSingleNode("ProjectionKernel");
	m_projectionKernel = ker3d_default;
	if (node) {
		std::string sProjKernel = node.getContent();

		if (sProjKernel == "default") {

		} else if (sProjKernel == "sum_square_weights") {
			m_projectionKernel = ker3d_sum_square_weights;
		} else {
			return false;
		}
	}
	CC.markNodeParsed("ProjectionKernel");

	m_bIsInitialized = _check();
	return m_bIsInitialized;
}
Exemplo n.º 14
0
// --- demo ---
what_happened start_me(orders order) {
	int size=5;
	if (order == orders::do_bad_soft_input) size=99999;
	_try_input(size < 10);

	int ix=5;
	std::vector<float> vec(100);
	if (order == orders::do_bad_array_index) ix=99999;
	auto val = vec.at(ix);
	_dbg4(val);

	bool file_opened=true;
	if (order == orders::do_bad_soft_sys) file_opened=false;
	_try_sys( file_opened ); // soft error, e.g. this files often file to open

	bool tmp_ok=true;
	if (order == orders::do_bad_hard_sys) tmp_ok=false;
	_check_sys(tmp_ok); // hard error

	int size_half = size/2;
	if (order == orders::do_bad_check) size_half *= 5; // programming error
	_check(size_half <= size);

	// assert()
	if (order == orders::do_our_assert) _check_abort( 2+2 == 5); // will abort here then
	if (order == orders::do_critical) throw example_critical_error();

	if (order == orders::do_silly_throw) throw 42;

	return what_happened::all_fine;
}
Exemplo n.º 15
0
static int
_watch (cherokee_fdpoll_select_t *fdp, int timeout_msecs)
{
	int mfd;
	int r, idx, ridx;

	fdp->working_rfdset = fdp->master_rfdset;
	fdp->working_wfdset = fdp->master_wfdset;
	mfd = select_get_maxfd(fdp);
	if (timeout_msecs == INFTIM) {
		r = select (mfd + 1, &fdp->working_rfdset, &fdp->working_wfdset, NULL, NULL);
	} else {
		struct timeval timeout;
		timeout.tv_sec = timeout_msecs / 1000L;
		timeout.tv_usec = ( timeout_msecs % 1000L ) * 1000L;
		r = select (mfd + 1, &fdp->working_rfdset, &fdp->working_wfdset, NULL, &timeout);
	}

	if (r <= 0) {
		return r;
	}

	ridx = 0;
	for (idx = 0; idx < FDPOLL(fdp)->npollfds; ++idx) {
		if (_check (fdp, fdp->select_fds[idx], 0)) {
			fdp->select_rfdidx[ridx++] = fdp->select_fds[idx];
			if (ridx == r)
				break;
		}
	}

	return ridx;        /* should be equal to r */
}
Exemplo n.º 16
0
void CudnnLibrary::cudnnSetPooling2dDescriptor(cudnnPoolingDescriptor_t poolingDesc,
                                                    cudnnPoolingMode_t mode,
                                                    cudnnNanPropagation_t nan,
                                                    int windowHeight,
                                                    int windowWidth,
                                                    int verticalPadding,
                                                    int horizontalPadding,
                                                    int verticalStride,
                                                    int horizontalStride
                                               )
{
    _check();

    auto status = (*_interface.cudnnSetPooling2dDescriptor_v4)(
        poolingDesc,
        mode,
        nan,
        windowHeight,
        windowWidth,
        verticalPadding,
        horizontalPadding,
        verticalStride,
        horizontalStride
        );

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnSetPooling2dDescriptor failed: " +
            _interface.getErrorString(status));
    }
}
//---------------------------------------------------------------------------------------
// Initialize - Config
bool CCudaFDKAlgorithm3D::initialize(const Config& _cfg)
{
	ASTRA_ASSERT(_cfg.self);
	ConfigStackCheck<CAlgorithm> CC("CudaFDKAlgorithm3D", this, _cfg);

	// if already initialized, clear first
	if (m_bIsInitialized) {
		clear();
	}

	// initialization of parent class
	if (!CReconstructionAlgorithm3D::initialize(_cfg)) {
		return false;
	}

	initializeFromProjector();

	// Deprecated options
	m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", m_iVoxelSuperSampling);
	m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", m_iGPUIndex);
	m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUIndex", m_iGPUIndex);
	CC.markOptionParsed("VoxelSuperSampling");
	CC.markOptionParsed("GPUIndex");
	if (!_cfg.self.hasOption("GPUIndex"))
		CC.markOptionParsed("GPUindex");



	m_bShortScan = _cfg.self.getOptionBool("ShortScan", false);
	CC.markOptionParsed("ShortScan");

	// success
	m_bIsInitialized = _check();
	return m_bIsInitialized;
}
//---------------------------------------------------------------------------------------
// Initialize - Config
bool CConeVecProjectionGeometry3D::initialize(const Config& _cfg)
{
	ASTRA_ASSERT(_cfg.self);
	ConfigStackCheck<CProjectionGeometry3D> CC("ConeVecProjectionGeometry3D", this, _cfg);	

	XMLNode* node;

	// TODO: Fix up class hierarchy... this class doesn't fit very well.
	// initialization of parent class
	//CProjectionGeometry3D::initialize(_cfg);

	// Required: DetectorRowCount
	node = _cfg.self->getSingleNode("DetectorRowCount");
	ASTRA_CONFIG_CHECK(node, "ConeVecProjectionGeometry3D", "No DetectorRowCount tag specified.");
	m_iDetectorRowCount = boost::lexical_cast<int>(node->getContent());
	ASTRA_DELETE(node);
	CC.markNodeParsed("DetectorRowCount");

	// Required: DetectorColCount
	node = _cfg.self->getSingleNode("DetectorColCount");
	ASTRA_CONFIG_CHECK(node, "ConeVecProjectionGeometry3D", "No DetectorColCount tag specified.");
	m_iDetectorColCount = boost::lexical_cast<int>(node->getContent());
	m_iDetectorTotCount = m_iDetectorRowCount * m_iDetectorColCount;
	ASTRA_DELETE(node);
	CC.markNodeParsed("DetectorColCount");

	// Required: Vectors
	node = _cfg.self->getSingleNode("Vectors");
	ASTRA_CONFIG_CHECK(node, "ConeVecProjectionGeometry3D", "No Vectors tag specified.");
	vector<double> data = node->getContentNumericalArrayDouble();
	CC.markNodeParsed("Vectors");
	ASTRA_DELETE(node);
	ASTRA_CONFIG_CHECK(data.size() % 12 == 0, "ConeVecProjectionGeometry3D", "Vectors doesn't consist of 12-tuples.");
	m_iProjectionAngleCount = data.size() / 12;
	m_pProjectionAngles = new SConeProjection[m_iProjectionAngleCount];

	for (int i = 0; i < m_iProjectionAngleCount; ++i) {
		SConeProjection& p = m_pProjectionAngles[i];
		p.fSrcX  = data[12*i +  0];
		p.fSrcY  = data[12*i +  1];
		p.fSrcZ  = data[12*i +  2];
		p.fDetUX = data[12*i +  6];
		p.fDetUY = data[12*i +  7];
		p.fDetUZ = data[12*i +  8];
		p.fDetVX = data[12*i +  9];
		p.fDetVY = data[12*i + 10];
		p.fDetVZ = data[12*i + 11];

		// The backend code currently expects the corner of the detector, while
		// the matlab interface supplies the center
		p.fDetSX = data[12*i +  3] - 0.5f * m_iDetectorRowCount * p.fDetVX - 0.5f * m_iDetectorColCount * p.fDetUX;
		p.fDetSY = data[12*i +  4] - 0.5f * m_iDetectorRowCount * p.fDetVY - 0.5f * m_iDetectorColCount * p.fDetUY;
		p.fDetSZ = data[12*i +  5] - 0.5f * m_iDetectorRowCount * p.fDetVZ - 0.5f * m_iDetectorColCount * p.fDetUZ;
	}

	// success
	m_bInitialized = _check();
	return m_bInitialized;
}
Exemplo n.º 19
0
GError*
meta0_assign_prefix_to_meta1(struct meta0_backend_s *m0, gchar *ns_name, gboolean nocheck)
{
	// GET meta1 list from conscience
	GList *working_m1list = NULL;
	GSList *unref_m1list = NULL;
	GError *error;
	GPtrArray *new_meta1ref = NULL;

	GRID_INFO("START Assign prefix");

	error = _initContext(m0);
	if (error) {
		goto errorLabel;
	}

	// build working list , list sorted by score
	error = _init_assign(ns_name,&working_m1list,&unref_m1list);
	if ( error ) {
		goto errorLabel;
	}
	if ( nocheck ) {
		error =_check(working_m1list);
		if ( error ) {
			goto errorLabel;
		}
	}

	error = _assign(working_m1list,unref_m1list);	
	if ( error ) {
		goto errorLabel;
	}

	new_meta1ref = _updated_meta1ref();
	error = meta0_backend_assign(m0, context->array_meta1_by_prefix, new_meta1ref,FALSE);
	if ( error ) {
		GRID_ERROR("failed to update BDD :(%d) %s", error->code, error->message);
		goto errorLabel;
	}
	context->lastAssignTime=g_date_time_new_now_local();

errorLabel :
	_resetContext();
	if (new_meta1ref) {
		meta0_utils_array_meta1ref_clean(new_meta1ref);
	}
	if (working_m1list) {
		g_list_free(working_m1list);
		working_m1list=NULL;
	}
	if (unref_m1list) {
		g_slist_free(unref_m1list);
		unref_m1list=NULL;
	}
	GRID_INFO("END ASSIGN");

	return error;
}
Exemplo n.º 20
0
    HostAndPort ReplicaSetMonitor::getMaster() {
        if ( _master < 0 || !_nodes[_master].ok )
            _check();

        uassert( 10009 , str::stream() << "ReplicaSetMonitor no master found for set: " << _name , _master >= 0 );

        scoped_lock lk( _lock );
        return _nodes[_master].addr;
    }
//---------------------------------------------------------------------------------------
// Initialize - Config
bool CCudaFDKAlgorithm3D::initialize(const Config& _cfg)
{
	ASTRA_ASSERT(_cfg.self);
	ConfigStackCheck<CAlgorithm> CC("CudaFDKAlgorithm3D", this, _cfg);

	// if already initialized, clear first
	if (m_bIsInitialized) {
		clear();
	}

	// initialization of parent class
	if (!CReconstructionAlgorithm3D::initialize(_cfg)) {
		return false;
	}

	initializeFromProjector();

	// Deprecated options
	m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", m_iVoxelSuperSampling);
	m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", m_iGPUIndex);
	m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUIndex", m_iGPUIndex);
	CC.markOptionParsed("VoxelSuperSampling");
	CC.markOptionParsed("GPUIndex");
	if (!_cfg.self.hasOption("GPUIndex"))
		CC.markOptionParsed("GPUindex");
	
	// filter
	if (_cfg.self.hasOption("FilterSinogramId")){
		m_iFilterDataId = (int)_cfg.self.getOptionInt("FilterSinogramId");
		const CFloat32ProjectionData2D * pFilterData = dynamic_cast<CFloat32ProjectionData2D*>(CData2DManager::getSingleton().get(m_iFilterDataId));
		if (!pFilterData){
			ASTRA_ERROR("Incorrect FilterSinogramId");
			return false;
		}
		const CProjectionGeometry3D* projgeom = m_pSinogram->getGeometry();
		const CProjectionGeometry2D* filtgeom = pFilterData->getGeometry();
		int iPaddedDetCount = calcNextPowerOfTwo(2 * projgeom->getDetectorColCount());
		int iHalfFFTSize = calcFFTFourierSize(iPaddedDetCount);
		if(filtgeom->getDetectorCount()!=iHalfFFTSize || filtgeom->getProjectionAngleCount()!=projgeom->getProjectionCount()){
			ASTRA_ERROR("Filter size does not match required size (%i angles, %i detectors)",projgeom->getProjectionCount(),iHalfFFTSize);
			return false;
		}
	}else
	{
		m_iFilterDataId = -1;
	}
	CC.markOptionParsed("FilterSinogramId");



	m_bShortScan = _cfg.self.getOptionBool("ShortScan", false);
	CC.markOptionParsed("ShortScan");

	// success
	m_bIsInitialized = _check();
	return m_bIsInitialized;
}
Exemplo n.º 22
0
achievement::achievement(const QString &name, const QString &description, const achievementCheckDelegate &check, const int &reward, const QDateTime &achieveDate) : QObject(0)
{
    _name = name;
    _description = description;
    _check = check;
    _reward = reward;
    _achieveDate = achieveDate;
    _achieved = _check();
}
//----------------------------------------------------------------------------------------
// Initialize - C++
bool CReconstructionAlgorithm2D::initialize(CProjector2D* _pProjector, 
							   CFloat32ProjectionData2D* _pSinogram, 
							   CFloat32VolumeData2D* _pReconstruction)
{
	m_pProjector = _pProjector;
	m_pSinogram = _pSinogram;
	m_pReconstruction = _pReconstruction;

	// return success
	return _check();
}
Exemplo n.º 24
0
void AtlasLibrary::sgemm(const int Order, const int TransA,
         const int TransB, const int M, const int N,
         const int K, const float alpha, const float *A,
         const int lda, const float *B, const int ldb,
         const float beta, float *C, const int ldc)
{
	_check();
	
	(*_interface.cblas_sgemm)(Order, TransA, TransB, M, N, K, alpha, A, lda, B,
		ldb, beta, C, ldc);
}
Exemplo n.º 25
0
uint32 Connection::doExecute(sqlite3 *connection, const String &sql)
{
	if(m_showSql)
		OS_LOG_NOTICE(sql);
	_check(connection);

	scoped_ptr<Result> result(OS_NEW Result(connection, m_cs));
	result->execute(sql);
	// Restituisce il numero di records affetti
	return sqlite3_changes(connection);
}
Exemplo n.º 26
0
stacklet_handle stacklet_new(stacklet_thread_handle thrd,
                             stacklet_run_fn run, void *run_arg)
{
    long stackmarker;
    _check((char *)NULL < (char *)&stackmarker);
    if (thrd->g_current_stack_stop <= (char *)&stackmarker)
        thrd->g_current_stack_stop = ((char *)&stackmarker) + 1;

    thrd->g_current_stack_marker = (char *)&stackmarker;
    g_initialstub(thrd, run, run_arg);
    return thrd->g_source;
}
Exemplo n.º 27
0
void CudnnLibrary::cudnnSetStream(void* stream)
{
    _check();

    auto status = (*_interface.cudnnSetStream)(_interface.getHandle(), stream);

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnSetStream failed: " +
            _interface.getErrorString(status));
    }
}
Exemplo n.º 28
0
void CudnnLibrary::cudnnCreateDropoutDescriptor(cudnnDropoutDescriptor_t* dropoutDesc)
{
    _check();

    auto status = (*_interface.cudnnCreateDropoutDescriptor)(dropoutDesc);

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnCreateDropoutDescriptor failed: " +
            _interface.getErrorString(status));
    }
}
Exemplo n.º 29
0
shared_ptr<Result> Connection::doQuery(sqlite3 *connection, const String &sql)
{
	if(m_showSql)
		OS_LOG_NOTICE(sql);
	// Nota: la bind del risultato al DataTable va loccata altrimenti si può generare un errore di tipo "Commands out of sync" (essendo la funzione chiamata da threads diversi)

	_check(connection);

	shared_ptr<Result> result(OS_NEW Result(connection, m_cs));
	result->prepare(sql);
	return result;
}
Exemplo n.º 30
0
void CudnnLibrary::cudnnDestroyRNNDescriptor(cudnnRNNDescriptor_t rnnDesc)
{
    _check();

    auto status = (*_interface.cudnnDestroyRNNDescriptor)(rnnDesc);

    if(status != CUDNN_STATUS_SUCCESS)
    {
        throw std::runtime_error("cudnnDestroyRnnDescriptor failed: " +
            _interface.getErrorString(status));
    }
}