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)
4fn main() {
5 let project_path = "tests/example_cuda_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cu"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = (0..20)
10 .into_iter()
11 .map(|_| JsonValue::Null)
12 .collect::<Vec<JsonValue>>();
13 let mut parabuilder = Parabuilder::new(
14 project_path,
15 workspaces_path,
16 template_path,
17 &[target_executable_file],
18 )
19 .in_place_template(true)
20 .build_workers(2)
21 .run_method(RunMethod::OutOfPlace(2));
22 parabuilder.set_datas(datas).unwrap();
23 parabuilder.init_workspace().unwrap();
24 parabuilder.run().unwrap();
25}
More examples
examples/quick_start.rs (lines 10-15)
4fn main() {
5 let project_path = "tests/example_cmake_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cpp.template"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
10 let mut parabuilder = Parabuilder::new(
11 project_path,
12 workspaces_path,
13 template_path,
14 &[target_executable_file],
15 );
16 parabuilder.set_datas(datas).unwrap();
17 parabuilder.init_workspace().unwrap();
18 let (run_data, _compile_error_datas, _processed_data_ids): (
19 JsonValue,
20 Vec<JsonValue>,
21 Vec<usize>,
22 ) = parabuilder.run().unwrap();
23 println!("{}", to_string_pretty(&run_data).unwrap());
24 /*
25 [
26 {
27 "data": {
28 "N": "10"
29 },
30 "status": 0,
31 "stderr": "",
32 "stdout": "10\n"
33 },
34 {
35 "data": {
36 "N": "20"
37 },
38 "status": 0,
39 "stderr": "",
40 "stdout": "20\n"
41 }
42 ]
43 */
44}
examples/complete_usage.rs (lines 18-23)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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)
4fn main() {
5 let project_path = "tests/example_cuda_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cu"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = (0..20)
10 .into_iter()
11 .map(|_| JsonValue::Null)
12 .collect::<Vec<JsonValue>>();
13 let mut parabuilder = Parabuilder::new(
14 project_path,
15 workspaces_path,
16 template_path,
17 &[target_executable_file],
18 )
19 .in_place_template(true)
20 .build_workers(2)
21 .run_method(RunMethod::OutOfPlace(2));
22 parabuilder.set_datas(datas).unwrap();
23 parabuilder.init_workspace().unwrap();
24 parabuilder.run().unwrap();
25}
More examples
examples/complete_usage.rs (line 27)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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)
4fn main() {
5 let project_path = "tests/example_cuda_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cu"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = (0..20)
10 .into_iter()
11 .map(|_| JsonValue::Null)
12 .collect::<Vec<JsonValue>>();
13 let mut parabuilder = Parabuilder::new(
14 project_path,
15 workspaces_path,
16 template_path,
17 &[target_executable_file],
18 )
19 .in_place_template(true)
20 .build_workers(2)
21 .run_method(RunMethod::OutOfPlace(2));
22 parabuilder.set_datas(datas).unwrap();
23 parabuilder.init_workspace().unwrap();
24 parabuilder.run().unwrap();
25}
More examples
examples/complete_usage.rs (line 28)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
Sourcepub fn run_func(
self,
run_func: fn(&PathBuf, &str, &Value, &mut Value, &Arc<AtomicBool>) -> Result<Value, Box<dyn Error>>,
) -> Self
pub fn run_func( self, run_func: fn(&PathBuf, &str, &Value, &mut Value, &Arc<AtomicBool>) -> Result<Value, Box<dyn Error>>, ) -> Self
Examples found in repository?
examples/complete_usage.rs (line 32)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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)
4fn main() {
5 let project_path = "tests/example_cuda_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cu"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = (0..20)
10 .into_iter()
11 .map(|_| JsonValue::Null)
12 .collect::<Vec<JsonValue>>();
13 let mut parabuilder = Parabuilder::new(
14 project_path,
15 workspaces_path,
16 template_path,
17 &[target_executable_file],
18 )
19 .in_place_template(true)
20 .build_workers(2)
21 .run_method(RunMethod::OutOfPlace(2));
22 parabuilder.set_datas(datas).unwrap();
23 parabuilder.init_workspace().unwrap();
24 parabuilder.run().unwrap();
25}
More examples
examples/complete_usage.rs (line 33)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
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
pub fn autosave_interval(self, autosave_interval: u64) -> Self
pub fn autosave_dir<S: AsRef<Path>>(self, autosave_dir: S) -> 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)
4fn main() {
5 let project_path = "tests/example_cuda_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cu"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = (0..20)
10 .into_iter()
11 .map(|_| JsonValue::Null)
12 .collect::<Vec<JsonValue>>();
13 let mut parabuilder = Parabuilder::new(
14 project_path,
15 workspaces_path,
16 template_path,
17 &[target_executable_file],
18 )
19 .in_place_template(true)
20 .build_workers(2)
21 .run_method(RunMethod::OutOfPlace(2));
22 parabuilder.set_datas(datas).unwrap();
23 parabuilder.init_workspace().unwrap();
24 parabuilder.run().unwrap();
25}
More examples
examples/quick_start.rs (line 16)
4fn main() {
5 let project_path = "tests/example_cmake_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cpp.template"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
10 let mut parabuilder = Parabuilder::new(
11 project_path,
12 workspaces_path,
13 template_path,
14 &[target_executable_file],
15 );
16 parabuilder.set_datas(datas).unwrap();
17 parabuilder.init_workspace().unwrap();
18 let (run_data, _compile_error_datas, _processed_data_ids): (
19 JsonValue,
20 Vec<JsonValue>,
21 Vec<usize>,
22 ) = parabuilder.run().unwrap();
23 println!("{}", to_string_pretty(&run_data).unwrap());
24 /*
25 [
26 {
27 "data": {
28 "N": "10"
29 },
30 "status": 0,
31 "stderr": "",
32 "stdout": "10\n"
33 },
34 {
35 "data": {
36 "N": "20"
37 },
38 "status": 0,
39 "stderr": "",
40 "stdout": "20\n"
41 }
42 ]
43 */
44}
examples/complete_usage.rs (line 36)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
Sourcepub fn set_datas_with_processed_data_ids_set(
&mut self,
datas: Vec<JsonValue>,
processed_data_ids_set: HashSet<usize>,
) -> Result<(), Box<dyn Error>>
pub fn set_datas_with_processed_data_ids_set( &mut self, datas: Vec<JsonValue>, processed_data_ids_set: HashSet<usize>, ) -> Result<(), Box<dyn Error>>
Set datas to be rendered into the template
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)
4fn main() {
5 let project_path = "tests/example_cuda_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cu"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = (0..20)
10 .into_iter()
11 .map(|_| JsonValue::Null)
12 .collect::<Vec<JsonValue>>();
13 let mut parabuilder = Parabuilder::new(
14 project_path,
15 workspaces_path,
16 template_path,
17 &[target_executable_file],
18 )
19 .in_place_template(true)
20 .build_workers(2)
21 .run_method(RunMethod::OutOfPlace(2));
22 parabuilder.set_datas(datas).unwrap();
23 parabuilder.init_workspace().unwrap();
24 parabuilder.run().unwrap();
25}
More examples
examples/quick_start.rs (line 17)
4fn main() {
5 let project_path = "tests/example_cmake_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cpp.template"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
10 let mut parabuilder = Parabuilder::new(
11 project_path,
12 workspaces_path,
13 template_path,
14 &[target_executable_file],
15 );
16 parabuilder.set_datas(datas).unwrap();
17 parabuilder.init_workspace().unwrap();
18 let (run_data, _compile_error_datas, _processed_data_ids): (
19 JsonValue,
20 Vec<JsonValue>,
21 Vec<usize>,
22 ) = parabuilder.run().unwrap();
23 println!("{}", to_string_pretty(&run_data).unwrap());
24 /*
25 [
26 {
27 "data": {
28 "N": "10"
29 },
30 "status": 0,
31 "stderr": "",
32 "stdout": "10\n"
33 },
34 {
35 "data": {
36 "N": "20"
37 },
38 "status": 0,
39 "stderr": "",
40 "stdout": "20\n"
41 }
42 ]
43 */
44}
examples/complete_usage.rs (line 37)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
Sourcepub fn autosave_load(
&mut self,
start_time: String,
) -> (JsonValue, Vec<JsonValue>, Vec<usize>)
pub fn autosave_load( &mut self, start_time: String, ) -> (JsonValue, Vec<JsonValue>, Vec<usize>)
Load autosave data (run_datas, compile_error_datas, processed_data_ids)
Sourcepub fn run(
&self,
) -> Result<(JsonValue, Vec<JsonValue>, Vec<usize>), Box<dyn Error>>
pub fn run( &self, ) -> Result<(JsonValue, Vec<JsonValue>, Vec<usize>), Box<dyn Error>>
run the build system
Examples found in repository?
examples/cuda_quick_start.rs (line 24)
4fn main() {
5 let project_path = "tests/example_cuda_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cu"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = (0..20)
10 .into_iter()
11 .map(|_| JsonValue::Null)
12 .collect::<Vec<JsonValue>>();
13 let mut parabuilder = Parabuilder::new(
14 project_path,
15 workspaces_path,
16 template_path,
17 &[target_executable_file],
18 )
19 .in_place_template(true)
20 .build_workers(2)
21 .run_method(RunMethod::OutOfPlace(2));
22 parabuilder.set_datas(datas).unwrap();
23 parabuilder.init_workspace().unwrap();
24 parabuilder.run().unwrap();
25}
More examples
examples/quick_start.rs (line 22)
4fn main() {
5 let project_path = "tests/example_cmake_project"; // your project path
6 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7 let template_path = "src/main.cpp.template"; // template file in the project
8 let target_executable_file = "build/main"; // target executable file
9 let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
10 let mut parabuilder = Parabuilder::new(
11 project_path,
12 workspaces_path,
13 template_path,
14 &[target_executable_file],
15 );
16 parabuilder.set_datas(datas).unwrap();
17 parabuilder.init_workspace().unwrap();
18 let (run_data, _compile_error_datas, _processed_data_ids): (
19 JsonValue,
20 Vec<JsonValue>,
21 Vec<usize>,
22 ) = parabuilder.run().unwrap();
23 println!("{}", to_string_pretty(&run_data).unwrap());
24 /*
25 [
26 {
27 "data": {
28 "N": "10"
29 },
30 "status": 0,
31 "stderr": "",
32 "stdout": "10\n"
33 },
34 {
35 "data": {
36 "N": "20"
37 },
38 "status": 0,
39 "stderr": "",
40 "stdout": "20\n"
41 }
42 ]
43 */
44}
examples/complete_usage.rs (line 42)
6fn main() {
7 let project_path = "tests/example_run_time_consuming_project"; // your project path
8 let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
9 let template_path = "src/main.cpp.template"; // template file in the project
10 let target_executable_file = "build/main"; // target executable file
11 let mut datas = (1..=100)
12 .map(|i| json!({"N": i}))
13 .collect::<Vec<JsonValue>>();
14 let error_data = json!({"N": "a"});
15 datas.push(error_data.clone());
16 let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
17 let compile_bash_script = r#"cmake --build build --target all -- -B"#;
18 let mut parabuilder = Parabuilder::new(
19 project_path,
20 workspaces_path,
21 template_path,
22 &[target_executable_file],
23 )
24 .init_bash_script(init_bash_script)
25 .compile_bash_script(compile_bash_script)
26 // .run_bash_script(format!(r#"./{}"#, target_executable_file).as_str())
27 .build_workers(4)
28 .run_method(RunMethod::OutOfPlace(2)) // 4 threads compile, 1 thread run
29 // .run_method(RunMethod::Exclusive) // 4 threads compile, 1 thread run
30 .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) // collect data that has compilation error
31 .auto_gather_array_data(true) // when each run thread finishes, gather the data into one array when every thread returns an array
32 .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
33 .in_place_template(false)
34 .disable_progress_bar(false);
35 // let sender = parabuilder.get_data_queue_sender().unwrap();
36 parabuilder.set_datas(datas).unwrap();
37 parabuilder.init_workspace().unwrap();
38 let (run_data, compile_error_datas, _processed_data_ids): (
39 JsonValue,
40 Vec<JsonValue>,
41 Vec<usize>,
42 ) = parabuilder.run().unwrap();
43 println!(
44 "run_data: {}",
45 serde_json::to_string_pretty(&run_data).unwrap()
46 );
47 println!("compile_error_datas: {:?}", compile_error_datas);
48}
pub fn gather_data( &self, run_data_array: Vec<JsonValue>, compile_error_datas: Vec<JsonValue>, processed_data_ids: Vec<usize>, ) -> Result<(JsonValue, Vec<JsonValue>, Vec<usize>), Box<dyn Error>>
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