Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/active_messaging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,14 +738,6 @@ pub trait AmDist: serde::ser::Serialize + serde::de::DeserializeOwned + SyncSend

impl<T: serde::ser::Serialize + serde::de::DeserializeOwned + SyncSend + 'static> AmDist for T {}

#[derive(
serde::Serialize, serde::Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord,
)]
pub(crate) enum ExecType {
Am(Cmd),
Runtime(Cmd),
}

#[doc(hidden)]
#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
pub enum RemotePtr {
Expand Down
46 changes: 23 additions & 23 deletions src/env_var.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

use serde::Deserialize;
use std::sync::OnceLock;
use crate::ExecutorType;

fn default_deadlock_warning_timeout() -> f64 {
600.0
Expand All @@ -57,20 +58,6 @@ fn default_dissemination_factor() -> usize {
2
}

fn default_backend() -> String {
#[cfg(feature = "rofi")]
return "rofi".to_owned();
#[cfg(not(feature = "rofi"))]
return "local".to_owned();
}

fn default_executor() -> String {
#[cfg(feature = "tokio-executor")]
return "tokio".to_owned();
#[cfg(not(feature = "tokio-executor"))]
return "lamellar".to_owned();
}

fn default_batcher() -> String {
"simple".to_owned()
}
Expand Down Expand Up @@ -109,15 +96,14 @@ fn default_alloc() -> Alloc {
}

#[doc(hidden)]
#[derive(Deserialize, Debug, PartialEq)]
#[derive(Deserialize, Debug, Default, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum IndexType {
Static,

#[default]
Dynamic,
}
fn default_array_dynamic_index() -> IndexType {
IndexType::Dynamic
}

fn default_cmd_buf_len() -> usize {
50000
Expand Down Expand Up @@ -156,6 +142,23 @@ where
}
}

/// The lamellae backend to use
#[doc(hidden)]
#[derive(Deserialize, Debug, Default)]
pub enum Backend {
/// multi pe distributed execution, default if rofi feature is turned on
#[cfg(feature = "rofi")]
#[cfg_attr(feature = "rofi", default)]
Rofi,

/// Single pe execution, default if rofi feature is turned off
#[cfg_attr(not(feature = "rofi"), default)]
Shmem,

/// Multi pe single node execution
Local
}

#[doc(hidden)]
#[derive(Deserialize, Debug)]
pub struct Config {
Expand Down Expand Up @@ -187,12 +190,10 @@ pub struct Config {
/// rofi -- multi pe distributed execution, default if rofi feature is turned on
/// local -- single pe execution, default if rofi feature is turned off
/// shmem -- multi pe single node execution
#[serde(default = "default_backend")]
pub backend: String, //rofi,shmem,local
pub backend: Backend,

/// The executor (thread scheduler) to use, default: 'lamellar' unless the tokio feature is turned on
#[serde(default = "default_executor")]
pub executor: String, //lamellar,tokio,async_std
pub executor: ExecutorType,

/// The batcher to use, default: 'simple'
#[serde(default = "default_batcher")]
Expand All @@ -205,7 +206,6 @@ pub struct Config {
pub heap_mode: HeapMode,
#[serde(default = "default_alloc")]
pub alloc: Alloc,
#[serde(default = "default_array_dynamic_index")]
pub index_size: IndexType,

//used internally by the command queues
Expand Down
23 changes: 3 additions & 20 deletions src/lamellae.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::active_messaging::Msg;
use crate::config;
use crate::lamellar_arch::LamellarArchRT;
use crate::scheduler::Scheduler;
use std::sync::Arc;
Expand Down Expand Up @@ -36,14 +35,16 @@ lazy_static! {

/// The list of available lamellae backends, used to specify how data is transferred between PEs
#[derive(
serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq, Ord, PartialOrd, Hash, Clone, Copy,
serde::Serialize, serde::Deserialize, Debug, Default, PartialEq, Eq, Ord, PartialOrd, Hash, Clone, Copy,
)]
pub enum Backend {
#[cfg(feature = "rofi")]
#[cfg_attr(docsrs, doc(cfg(feature = "rofi")))]
#[cfg_attr(feature = "rofi", default)]
/// The Rofi (Rust-OFI) backend -- intended for multi process and distributed environments
Rofi,
/// The Local backend -- intended for single process environments
#[cfg_attr(not(feature = "rofi"), default)]
Local,
/// The Shmem backend -- intended for multi process environments single node environments
Shmem,
Expand All @@ -56,24 +57,6 @@ pub(crate) enum AllocationType {
Sub(Vec<usize>),
}

impl Default for Backend {
fn default() -> Self {
match config().backend.as_str() {
"rofi" => {
#[cfg(feature = "rofi")]
return Backend::Rofi;
#[cfg(not(feature = "rofi"))]
panic!("unable to set rofi backend, recompile with 'enable-rofi' feature")
}
"shmem" => {
return Backend::Shmem;
}
_ => {
return Backend::Local;
}
}
}
}
// fn default_backend() -> Backend {
// match std::env::var("LAMELLAE_BACKEND") {
// Ok(p) => match p.as_str() {
Expand Down
18 changes: 1 addition & 17 deletions src/lamellar_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,27 +457,11 @@ impl LamellarWorldBuilder {
pub fn new() -> LamellarWorldBuilder {
// simple_logger::init().unwrap();
// trace!("New world builder");
let executor = match config().executor.as_str(){
"tokio" => {
#[cfg(not(feature = "tokio-executor"))]
{
panic!("[LAMELLAR WARNING]: tokio-executor selected but it is not enabled, either recompile lamellar with --features tokio-executor, or set LAMELLAR_EXECUTOR to one of 'lamellar' or 'async_std'");
}
#[cfg(feature = "tokio-executor")]
ExecutorType::Tokio
}
"async_std" => ExecutorType::AsyncStd,
"lamellar" => ExecutorType::LamellarWorkStealing,
"lamellar2" => ExecutorType::LamellarWorkStealing2,
"lamellar3" => ExecutorType::LamellarWorkStealing3,
_ => panic!("[LAMELLAR WARNING]: unexpected executor type, please set LAMELLAR_EXECUTOR to one of the following 'lamellar', 'async_std', or (if tokio-executor feature is enabled, 'tokio'.")
};

let num_threads = config().threads;
LamellarWorldBuilder {
primary_lamellae: Default::default(),
// secondary_lamellae: HashSet::new(),
executor,
executor: config().executor,
num_threads,
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use async_std_executor::AsyncStdRt;
pub(crate) mod tokio_executor;
#[cfg(feature = "tokio-executor")]
use tokio_executor::TokioRt;

use crate::Deserialize;
// ACTIVE ENUM
// since atomic enums would be another dependecy

Expand Down Expand Up @@ -78,19 +78,20 @@ pub(crate) struct ReqId {
/// Default is a work stealing executor
/// If the "tokio-executor" feature is enabled,the tokio executor can also be used
/// allowing seamless integration with tokio based applications
#[derive(Debug)]
#[derive(Copy, Clone, Debug, Default, Deserialize, PartialEq, Eq)]
pub enum ExecutorType {
/// The default work stealing executor
#[default]
LamellarWorkStealing,
/// Experimental numa-aware(ish) work stealing executor
LamellarWorkStealing2,
/// Experimental numa-aware(ish) work stealing executor
LamellarWorkStealing3,
/// executor provided by the AsyncStd crate
AsyncStd,
/// The tokio executor
#[cfg(feature = "tokio-executor")]
#[cfg_attr(docsrs, doc(cfg(feature = "tokio-executor")))]
/// The tokio executor
Tokio,
// Dyn(impl LamellarExecutor),
}
Expand Down