Exemple #1
0
Eigen::VectorXd DistributedDiff::diff(const unsigned long long &u_ts, const Eigen::VectorXd &samples) {

	addDataToBuffer(u_ts, samples);

	// Next we want to calculate all the differentials
	Eigen::VectorXd diff_(size);
	diff_ = FindDifferentials();

	return diff_;
}
Exemple #2
0
void GeneOntology::synchronize(){

	// we received the response
	if(m_inbox->hasMessage(RAY_MPI_TAG_SYNCHRONIZE_TERMS_REPLY)){

		#ifdef DEBUG_ONTOLOGY_SYNC
		cout<<"[DEBUG_ONTOLOGY_SYNC] Received RAY_MPI_TAG_SYNCHRONIZE_TERMS_REPLY"<<endl;
		#endif

		m_waitingForReply=false;
	}

	if(m_waitingForReply){
		return;
	}

	bool isMaster=m_core->getRank() == MASTER_RANK;

	if(!m_synchronizedTotal && !isMaster){
	
		MessageUnit*buffer=(MessageUnit*)m_outboxAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);
		int bufferPosition=0;

		m_synchronizedTotal=true;

		buffer[bufferPosition++]=SENTINEL_VALUE_FOR_TOTAL;
		buffer[bufferPosition++]=SENTINEL_VALUE_FOR_TOTAL;
		buffer[bufferPosition++]=m_kmerObservationsWithGeneOntologies;

		m_switchMan->sendMessage(buffer,bufferPosition,m_outbox,m_rank,MASTER_RANK,RAY_MPI_TAG_SYNCHRONIZE_TERMS);

		m_waitingForReply=true;

		return;

	}

	// sync with master

	if(hasDataToSync() && !isMaster){

		#ifdef DEBUG_ONTOLOGY_SYNC
		cout<<"[DEBUG_ONTOLOGY_SYNC] Will create data message"<<endl;
		#endif

		MessageUnit*buffer=(MessageUnit*)m_outboxAllocator->allocate(MAXIMUM_MESSAGE_SIZE_IN_BYTES);

		#ifdef ASSERT
		assert(buffer!=NULL);
		#endif

		int bufferPosition=0;

		int available=(MAXIMUM_MESSAGE_SIZE_IN_BYTES/sizeof(MessageUnit))/3;
		int added=0;

		while(hasDataToSync() && added < available){

			#ifdef DEBUG_ONTOLOGY_SYNC
			cout<<"[DEBUG_ONTOLOGY_SYNC] will add an object."<<endl;
			#endif

			#ifdef ASSERT
			if(added==0){
				assert(bufferPosition==0);
			}
			#endif
				
			addDataToBuffer(buffer,&bufferPosition);

			#ifdef ASSERT
			assert(bufferPosition%3 == 0);
			#endif

			added++;

			#ifdef DEBUG_ONTOLOGY_SYNC
			cout<<"[DEBUG_ONTOLOGY_SYNC] added "<<added<<" available "<<available<<endl;
			#endif
		}

		#ifdef DEBUG_ONTOLOGY_SYNC
		cout<<"[DEBUG_ONTOLOGY_SYNC] sending RAY_MPI_TAG_SYNCHRONIZE_TERMS"<<endl;
		#endif

		m_switchMan->sendMessage(buffer,bufferPosition,m_outbox,m_rank,MASTER_RANK,RAY_MPI_TAG_SYNCHRONIZE_TERMS);

		m_waitingForReply=true;
	}

	/* we are not waiting for a reply and we don't have more data to synchronize */
	if(!m_waitingForReply){
		m_synced=true;

		cout<<"Rank "<<m_rank<<": synced ontology term profiles with master"<<endl;

		m_switchMan->sendMessage(NULL,0,m_outbox,m_rank,MASTER_RANK,RAY_MPI_TAG_SYNCHRONIZATION_DONE);
	}
}
void DocBookBookReader::characterDataHandler(const char *text, std::size_t len) {
	addDataToBuffer(text, len);
}