pub struct Parabuilder { /* private fields */ }Expand description
The main body of building system
Implementations§
Source§impl Parabuilder
impl Parabuilder
pub const TEMP_TARGET_PATH_DIR: &'static str = "targets"
Sourcepub fn new<P, Q, R, S>(
project_path: P,
workspaces_path: Q,
template_file: R,
target_files: &[S],
) -> Self
pub fn new<P, Q, R, S>( project_path: P, workspaces_path: Q, template_file: R, target_files: &[S], ) -> Self
Examples found in repository?
examples/cuda_quick_start.rs (lines 13-18)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() {
let project_path = "tests/example_cuda_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cu"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = (0..5)
.into_iter()
.map(|_| JsonValue::Null)
.collect::<Vec<JsonValue>>();
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.in_place_template(true)
.build_workers(2)
.run_method(RunMethod::OutOfPlace(7));
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
parabuilder.run().unwrap();
}More examples
examples/quick_start.rs (lines 10-15)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
fn main() {
let project_path = "tests/example_cmake_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
);
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, _compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("{}", to_string_pretty(&run_data).unwrap());
/*
[
{
"data": {
"N": "10"
},
"status": 0,
"stderr": "",
"stdout": "10\n"
},
{
"data": {
"N": "20"
},
"status": 0,
"stderr": "",
"stdout": "20\n"
}
]
*/
}examples/complete_usage.rs (lines 18-23)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Sourcepub fn init_bash_script(self, init_bash_script: &str) -> Self
pub fn init_bash_script(self, init_bash_script: &str) -> Self
Examples found in repository?
examples/complete_usage.rs (line 24)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Sourcepub fn compile_bash_script(self, compile_bash_script: &str) -> Self
pub fn compile_bash_script(self, compile_bash_script: &str) -> Self
Examples found in repository?
examples/complete_usage.rs (line 25)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}pub fn run_bash_script(self, run_bash_script: &str) -> Self
Sourcepub fn build_workers(self, build_workers: usize) -> Self
pub fn build_workers(self, build_workers: usize) -> Self
Examples found in repository?
examples/cuda_quick_start.rs (line 20)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() {
let project_path = "tests/example_cuda_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cu"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = (0..5)
.into_iter()
.map(|_| JsonValue::Null)
.collect::<Vec<JsonValue>>();
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.in_place_template(true)
.build_workers(2)
.run_method(RunMethod::OutOfPlace(7));
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
parabuilder.run().unwrap();
}More examples
examples/complete_usage.rs (line 27)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}pub fn run_workers(self, run_workers: isize) -> Self
pub fn run_workers_exclusive(self, run_workers: isize) -> Self
Sourcepub fn run_method(self, run_method: RunMethod) -> Self
pub fn run_method(self, run_method: RunMethod) -> Self
Examples found in repository?
examples/cuda_quick_start.rs (line 21)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() {
let project_path = "tests/example_cuda_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cu"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = (0..5)
.into_iter()
.map(|_| JsonValue::Null)
.collect::<Vec<JsonValue>>();
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.in_place_template(true)
.build_workers(2)
.run_method(RunMethod::OutOfPlace(7));
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
parabuilder.run().unwrap();
}More examples
examples/complete_usage.rs (line 28)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Sourcepub fn run_func(
self,
run_func: fn(_: &PathBuf, _: &str, _: &JsonValue, _: &mut JsonValue) -> Result<JsonValue, Box<dyn Error>>,
) -> Self
pub fn run_func( self, run_func: fn(_: &PathBuf, _: &str, _: &JsonValue, _: &mut JsonValue) -> Result<JsonValue, Box<dyn Error>>, ) -> Self
Examples found in repository?
examples/complete_usage.rs (line 32)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Sourcepub fn compilation_error_handling_method(
self,
compilation_error_handling_method: CompliationErrorHandlingMethod,
) -> Self
pub fn compilation_error_handling_method( self, compilation_error_handling_method: CompliationErrorHandlingMethod, ) -> Self
Examples found in repository?
examples/complete_usage.rs (line 30)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Sourcepub fn auto_gather_array_data(self, auto_gather_array_data: bool) -> Self
pub fn auto_gather_array_data(self, auto_gather_array_data: bool) -> Self
Examples found in repository?
examples/complete_usage.rs (line 31)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Sourcepub fn in_place_template(self, in_place_template: bool) -> Self
pub fn in_place_template(self, in_place_template: bool) -> Self
Examples found in repository?
examples/cuda_quick_start.rs (line 19)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() {
let project_path = "tests/example_cuda_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cu"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = (0..5)
.into_iter()
.map(|_| JsonValue::Null)
.collect::<Vec<JsonValue>>();
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.in_place_template(true)
.build_workers(2)
.run_method(RunMethod::OutOfPlace(7));
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
parabuilder.run().unwrap();
}More examples
examples/complete_usage.rs (line 33)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Sourcepub fn disable_progress_bar(self, disable_progress_bar: bool) -> Self
pub fn disable_progress_bar(self, disable_progress_bar: bool) -> Self
Examples found in repository?
examples/complete_usage.rs (line 34)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}pub fn no_cache(self, no_cache: bool) -> Self
pub fn without_rsync(self, without_rsync: bool) -> Self
pub fn enable_cppflags(self, enable_cppflags: bool) -> Self
Sourcepub fn set_datas(&mut self, datas: Vec<JsonValue>) -> Result<(), Box<dyn Error>>
pub fn set_datas(&mut self, datas: Vec<JsonValue>) -> Result<(), Box<dyn Error>>
Set datas to be rendered into the template
Examples found in repository?
examples/cuda_quick_start.rs (line 22)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() {
let project_path = "tests/example_cuda_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cu"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = (0..5)
.into_iter()
.map(|_| JsonValue::Null)
.collect::<Vec<JsonValue>>();
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.in_place_template(true)
.build_workers(2)
.run_method(RunMethod::OutOfPlace(7));
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
parabuilder.run().unwrap();
}More examples
examples/quick_start.rs (line 16)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
fn main() {
let project_path = "tests/example_cmake_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
);
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, _compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("{}", to_string_pretty(&run_data).unwrap());
/*
[
{
"data": {
"N": "10"
},
"status": 0,
"stderr": "",
"stdout": "10\n"
},
{
"data": {
"N": "20"
},
"status": 0,
"stderr": "",
"stdout": "20\n"
}
]
*/
}examples/complete_usage.rs (line 36)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}pub fn get_data_queue_sender( &mut self, ) -> Result<Sender<(usize, JsonValue)>, Box<dyn Error>>
Sourcepub fn init_workspace(&self) -> Result<(), Box<dyn Error>>
pub fn init_workspace(&self) -> Result<(), Box<dyn Error>>
Initialize workspaces
Examples found in repository?
examples/cuda_quick_start.rs (line 23)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() {
let project_path = "tests/example_cuda_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cu"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = (0..5)
.into_iter()
.map(|_| JsonValue::Null)
.collect::<Vec<JsonValue>>();
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.in_place_template(true)
.build_workers(2)
.run_method(RunMethod::OutOfPlace(7));
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
parabuilder.run().unwrap();
}More examples
examples/quick_start.rs (line 17)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
fn main() {
let project_path = "tests/example_cmake_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
);
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, _compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("{}", to_string_pretty(&run_data).unwrap());
/*
[
{
"data": {
"N": "10"
},
"status": 0,
"stderr": "",
"stdout": "10\n"
},
{
"data": {
"N": "20"
},
"status": 0,
"stderr": "",
"stdout": "20\n"
}
]
*/
}examples/complete_usage.rs (line 37)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Sourcepub fn run(&self) -> Result<(JsonValue, Vec<JsonValue>), Box<dyn Error>>
pub fn run(&self) -> Result<(JsonValue, Vec<JsonValue>), Box<dyn Error>>
run the build system
Examples found in repository?
examples/cuda_quick_start.rs (line 24)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() {
let project_path = "tests/example_cuda_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cu"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = (0..5)
.into_iter()
.map(|_| JsonValue::Null)
.collect::<Vec<JsonValue>>();
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.in_place_template(true)
.build_workers(2)
.run_method(RunMethod::OutOfPlace(7));
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
parabuilder.run().unwrap();
}More examples
examples/quick_start.rs (line 18)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
fn main() {
let project_path = "tests/example_cmake_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
);
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, _compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("{}", to_string_pretty(&run_data).unwrap());
/*
[
{
"data": {
"N": "10"
},
"status": 0,
"stderr": "",
"stdout": "10\n"
},
{
"data": {
"N": "20"
},
"status": 0,
"stderr": "",
"stdout": "20\n"
}
]
*/
}examples/complete_usage.rs (line 38)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
fn main() {
let project_path = "tests/example_run_time_consuming_project"; // your project path
let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
let template_path = "src/main.cpp.template"; // template file in the project
let target_executable_file = "build/main"; // target executable file
let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
// .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
// .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
.compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
.auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
.run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
// let sender = parabuilder.get_data_queue_sender().unwrap();
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}Auto Trait Implementations§
impl Freeze for Parabuilder
impl RefUnwindSafe for Parabuilder
impl Send for Parabuilder
impl Sync for Parabuilder
impl Unpin for Parabuilder
impl UnwindSafe for Parabuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more