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));
Result
Enumeration of generic kernel API result codes.
static T * create()
Abstract function to create an instance of T.
Provides a buffered abstract interface to a file.
const Size size() const
Get file size.
Result read()
Read the file (buffered)
const void * buffer() const
Get file buffer.
CoreClient provides a simple interface to a CoreServer.
Core::Result createProcess(const Size coreId, const Address programAddr, const Size programSize, const char *programCmd) const
Create a new process on a different core.
Core::Result getCoreCount(Size &numCores) const
Get number of processor cores in the system.
virtual T * get(const Size position) const
Returns the item at the given position.
virtual bool insertAt(const Size position, T *item)
Inserts the given item at the given position.
Decompress data using the LZ4 algorithm created by Yann Collet.
Result initialize()
Initialize the decompressor.
u64 getUncompressedSize() const
Get size of the uncompressed data.
Result read(void *buffer, const Size size) const
Reads compressed data.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
static bool compare(const void *p1, const void *p2, const Size count)
Compare memory.
Unidirectional point-to-point channel using shared memory.
Result setPhysical(const Address data, const Address feedback, const bool hardReset=true)
Set memory pages by physical address.
virtual Result read(void *buffer)
Read a message.
virtual Result write(const void *buffer)
Write a message.
Represents a Message Passing Interface (MPI) implementation backend.
Implements a Message Passing Interface (MPI) for communication between local cores.
Index< MemoryChannel, MaximumChannels > m_readChannels
Stores all channels for receiving data from other cores.
Result createReadChannel(const Size coreId, const Address memoryBase)
Create a new MPI channel for reading.
Index< MemoryChannel, MaximumChannels > m_writeChannels
Stores all channels for sending data to other cores.
virtual Result getCommRank(MPI_Comm comm, int *rank)
Retrieve communication rank (core id)
Result initializeSlave(int *argc, char ***argv)
Initialize a slave.
virtual Result initialize(int *argc, char ***argv)
Initialize the backend.
static const Size MaximumChannels
Maximum number of communication channels.
virtual Result terminate()
Terminate the backend.
Address getMemoryBaseRead(const Size coreId) const
Get memory address for MPI read communication.
Size m_coreCount
Total number of cores.
virtual Result send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
Synchronous send data.
Result initializeMaster(int *argc, char ***argv)
Initialize the master.
virtual Result getCommSize(MPI_Comm comm, int *size)
Retrieve communication size (total cores)
Memory::Range m_memChannelBase
Memory base address for local MPI communication.
virtual Result receive(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)
Synchronous receive data.
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.
Address getMemoryBaseWrite(const Size coreId) const
Get memory address for MPI write communication.
long toLong(const Number::Base base=Number::Dec) const
Convert the String to a signed long integer.
API::Result ProcessCtl(const ProcessID proc, const ProcessOperation op, const Address addr=0, const Address output=0)
Prototype for user applications.
API::Result VMCtl(const ProcessID procID, const MemoryOperation op, Memory::Range *range=ZERO)
Prototype for user applications.
#define PAGESIZE
ARM uses 4K pages.
MPI_Datatype
Named Predefined Datatypes.
uint MPI_Status
Status holder.
uint MPI_Comm
Communicator identifier.
@ MPI_ERR_UNSUPPORTED_DATAREP
#define assert(exp)
Insert program diagnostics.
#define NULL
NULL means zero.
unsigned long Address
A memory address.
#define ERROR(msg)
Output an error message.
unsigned int Size
Any sane size indicator cannot go negative.
#define DEBUG(msg)
Output a debug message to standard output.
unsigned char u8
Unsigned 8-bit number.
Result
Result code for Actions.
Size size
Size in number of bytes.
Address phys
Physical address.
Address virt
Virtual address.
Access access
Page access flags.