/** * Perform the spectrum computations. * @return int Returns 0 when task was successfully started * @param inbuf Pointer to raw input Buffer * @param outbuf Pointer to spectrum output Buffer */ int TaskCoreCell::run(Buffer* inbuf, Buffer* outbuf) { int mbox; /* update SPE task context */ cb.terminate_flag = 0; cb.rawif_src.p = (void*) inbuf->getData(); cb.rawif_bytecount = inbuf->getLength(); cb.spectrum_dst.p = (void*) outbuf->getData(); /* task context ready, wake up the SPE to start processing */ spe_write_in_mbox(this->speid, 0x1234); /* remember the current output buffer for setting length on completion */ prevBufOut = outbuf; return 0; }
/** * Clean up all allocations etc * @return int Returns 0 on success */ int TaskCoreCell::finalize() { int status; /* tell SPE to exit */ cb.terminate_flag = 1; spe_write_in_mbox(this->speid, 0x1234); /* wait for the SPE program to exit */ spe_wait(this->speid, &status, 0); #if 1 cout << "SPE of rank " << rank << " completed, total time " << (double(total_time)/__timebase__) << "s, " << " total FFTs " << total_ffts_count << ", total spectra " << total_spectra_count << endl; #endif return 0; }
/** sends a 64-bit value to the SPE mailbox. */ static void writeMailBox( ppu_addr_t addr ){ speid_t spe_id = getSpeId(); spe_write_in_mbox( spe_id, (uint32_t)addr ); spe_write_in_mbox( spe_id, (uint32_t)(addr>>32) ); }