Go to the documentation of this file.
18 #include <FreeNOS/User.h>
93 for (
int i = 0; i < count; i++)
98 msg.
integer = *(((
int *) buf) + i);
102 msg.
uchar = *(((
u8 *) buf) + i);
134 for (
int i = 0; i < count; i++)
144 *(((
int *) buf) + i) = msg.
integer;
148 *(((
u8 *) buf) + i) = msg.
uchar;
163 char *programName = (*argv)[0];
174 ERROR(
"failed to retrieve core count from CoreServer: result = " << (
int) result);
182 programPath <<
"/bin/" << programName;
186 programPath << programName;
194 ERROR(
"failed to read program at path '" << *programPath <<
"': result = " << (
int) readResult);
203 ERROR(
"failed to initialize LZ4 decompressor: result = " << (
int) lz4Result);
209 uncompProgRange.
virt = 0;
210 uncompProgRange.
phys = 0;
216 ERROR(
"failed to allocate program buffer: result = " << (
int) vmResult);
220 programBuffer = (
u8 *) uncompProgRange.
virt;
227 ERROR(
"failed to decompress program buffer: result = " << (
int) decompResult);
240 ERROR(
"failed to allocate MemoryChannel: result = " << (
int) vmResult);
255 programCmd << programPath <<
" --slave " <<
260 for (
int j = 1; j < *argc; j++)
262 programCmd <<
" " << (*argv)[j];
269 ERROR(
"failed to create process on core" << i <<
": result = " << (
int) result);
280 ERROR(
"failed to create read MemoryChannel for core" << i <<
": result = " << (
int) readResult);
291 ERROR(
"failed to create write MemoryChannel for core" << i <<
": result = " << (
int) writeResult);
305 ERROR(
"invalid number of arguments given");
324 (*argv)[4] = (*argv)[0];
331 ERROR(
"failed to create read MemoryChannel for master: result = " << (
int) readResult);
338 ERROR(
"failed to create write MemoryChannel for master: result = " << (
int) writeResult);
351 ERROR(
"failed to allocate consumer MemoryChannel for coreId = " <<
coreId);
361 " feedback = " << (
void *) (memoryBase +
PAGESIZE));
373 ERROR(
"failed to allocate producer MemoryChannel for coreId = " <<
coreId);
382 DEBUG(
m_coreId <<
": writeChannel: core" <<
coreId <<
": data = " << (
void *) memoryBase <<
383 " feedback = " << (
void *) (memoryBase +
PAGESIZE));
CoreClient provides a simple interface to a CoreServer.
Provides a buffered abstract interface to a file.
static const Size MaximumChannels
Maximum number of communication channels.
virtual bool insertAt(const Size position, T *item)
Inserts the given item at the given position.
Result
Enumeration of generic kernel API result codes.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
Result setPhysical(const Address data, const Address feedback, const bool hardReset=true)
Set memory pages by physical address.
Result initializeSlave(int *argc, char ***argv)
Initialize a slave.
uint MPI_Comm
Communicator identifier.
virtual Result getCommRank(MPI_Comm comm, int *rank)
Retrieve communication rank (core id)
u64 getUncompressedSize() const
Get size of the uncompressed data.
#define PAGESIZE
ARM uses 4K pages.
Result initialize()
Initialize the decompressor.
Index< MemoryChannel, MaximumChannels > m_readChannels
Stores all channels for receiving data from other cores.
unsigned long Address
A memory address.
Result createWriteChannel(const Size coreId, const Address memoryBase)
Create a new MPI channel for writing.
Size m_coreId
Core identifier is a unique number on each core.
API::Result VMCtl(const ProcessID procID, const MemoryOperation op, Memory::Range *range=ZERO)
Prototype for user applications.
static bool compare(const void *p1, const void *p2, const Size count)
Compare memory.
API::Result ProcessCtl(const ProcessID proc, const ProcessOperation op, const Address addr=0, const Address output=0)
Prototype for user applications.
Core::Result createProcess(const Size coreId, const Address programAddr, const Size programSize, const char *programCmd) const
Create a new process on a different core.
Size m_coreCount
Total number of cores.
uint MPI_Status
Status holder.
const void * buffer() const
Get file buffer.
Result read()
Read the file (buffered)
Core::Result getCoreCount(Size &numCores) const
Get number of processor cores in the system.
#define DEBUG(msg)
Output a debug message to standard output.
Address phys
Physical address.
Memory::Range m_memChannelBase
Memory base address for local MPI communication.
Result initializeMaster(int *argc, char ***argv)
Initialize the master.
Result createReadChannel(const Size coreId, const Address memoryBase)
Create a new MPI channel for reading.
#define NULL
NULL means zero.
unsigned int Size
Any sane size indicator cannot go negative.
virtual Result write(const void *buffer)
Write a message.
static T * create()
Abstract function to create an instance of T.
Unidirectional point-to-point channel using shared memory.
MPI_Datatype
Named Predefined Datatypes.
virtual T * get(const Size position) const
Returns the item at the given position.
Address getMemoryBaseWrite(const Size coreId) const
Get memory address for MPI write communication.
virtual Result getCommSize(MPI_Comm comm, int *size)
Retrieve communication size (total cores)
virtual Result read(void *buffer)
Read a message.
Result
Result code for Actions.
virtual Result terminate()
Terminate the backend.
Represents a Message Passing Interface (MPI) implementation backend.
const Size size() const
Get file size.
#define assert(exp)
Insert program diagnostics.
Result read(void *buffer, const Size size) const
Reads compressed data.
#define ERROR(msg)
Output an error message.
unsigned char u8
Unsigned 8-bit number.
virtual Result initialize(int *argc, char ***argv)
Initialize the backend.
Decompress data using the LZ4 algorithm created by Yann Collet.
Address virt
Virtual address.
Index< MemoryChannel, MaximumChannels > m_writeChannels
Stores all channels for sending data to other cores.
Address getMemoryBaseRead(const Size coreId) const
Get memory address for MPI read communication.
virtual Result receive(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)
Synchronous receive data.
Size size
Size in number of bytes.
Access access
Page access flags.
Implements a Message Passing Interface (MPI) for communication between local cores.
@ MPI_ERR_UNSUPPORTED_DATAREP
virtual Result send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
Synchronous send data.
long toLong(const Number::Base base=Number::Dec) const
Convert the String to a signed long integer.