parabuild

Struct Parabuilder

Source
pub struct Parabuilder { /* private fields */ }
Expand description

The main body of building system

Implementations§

Source§

impl Parabuilder

Source

pub const TEMP_TARGET_PATH_DIR: &'static str = "targets"

Source

pub fn new<P, Q, R, S>( project_path: P, workspaces_path: Q, template_file: R, target_files: &[S], ) -> Self
where P: AsRef<Path>, Q: AsRef<Path>, R: AsRef<Path>, S: AsRef<Path>,

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
Hide additional 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);
}
Source

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);
}
Source

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);
}
Source

pub fn run_bash_script(self, run_bash_script: &str) -> Self

Source

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
Hide additional 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);
}
Source

pub fn run_workers(self, run_workers: isize) -> Self

Source

pub fn run_workers_exclusive(self, run_workers: isize) -> Self

Source

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
Hide additional 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);
}
Source

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);
}
Source

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);
}
Source

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);
}
Source

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
Hide additional 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);
}
Source

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);
}
Source

pub fn no_cache(self, no_cache: bool) -> Self

Source

pub fn without_rsync(self, without_rsync: bool) -> Self

Source

pub fn enable_cppflags(self, enable_cppflags: bool) -> Self

Source

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
Hide additional 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);
}
Source

pub fn get_data_queue_sender( &mut self, ) -> Result<Sender<(usize, JsonValue)>, Box<dyn Error>>

Source

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
Hide additional 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);
}
Source

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
Hide additional 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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.