MPI coupling application - mpi

I am working in a parallel program for simulating a couple physics problem where I have to create different communicators and inter-communicators. Let's say I have a program A and program B. I can have many processors executing A and B. The processes of B are going to be joined into small communicators where A will be in only one.
A1 --- B1 --- B2 --- B3
|
A2 --- B4
|
A3 --- B5 --- B6 --- B7
Here
A1, A2, A3 belong to comm_1
B1, B2, B3 to comm_2
B4 to comm_3
B5, B6, B7 to comm_4
This arrange and the number of process can vary for A and B depending on the problem. My idea is to read from an input this connectivity structure and according to it perform the splits of MPI_COMM_WORLD. The programs will be executed by:
mpirun -np np1 prog_1 : -np np2 prog_2
is this a valid procedure ? there exist a simpler way of doing this (without using MPI_Spawn and MPI_Comm_connect I mean to lunch all process at the same time with only one command) ?

Related

Running IRT with correlated items and many missing values

I'm hoping to run an IRT analysis where I have a couple families of items, and each person has answered one question from each family. Are there R packages for doing something like this? I've looked at options like hIRT but this seems to only account for individual level covariates, not item level covariates. I'm expecting the data to look something like this:
1a
1b
1c
2a
2b
2c
1
0
0
1
1
1
where each person answers one of 1a, 1b, and 1c, and one of 2a, 2b, and 2c.

Add a column of length matching that of another dataframe AND adjust the value of that column in each row depending on a filename

I have datasets formatted in a way represented by the set below:
FirstName Letter
Alexsmith A1
ThegreatAlex A6
AlexBobJones1 A7
Bobsmiles222 A1
Christopher A9
Christofer A6
I want to change it to this:
School FirstName Letter
Greenfield Alexsmith A1
Greenfield ThegreatAlex A6
Greenfield AlexBobJones1 A7
Greenfield Bobsmiles222 A1
Greenfield Christopher A9
Greenfield Christofer A6
I want to add a leftmost column indicated which school the dataset comes from. I am importing this data from csv into R to begin with, and the filenames already have the school name in them.
Is it possible to retrieve the school name from the file name? The filenames are formatted like this: SCHOOLNAME_1, SCHOOLNAME_2, etc. The numbers do not need to be retained
My goal here is to automate this process through a loop because of how many of these datasets I will be accumulating, which is why I am starting small with this question.
I tried something like this:
School <- c(length(schoolimport))
but don't know how to add in the values of each cell
Thank you & I am happy to clarify anything
Assuming you want them all in the same data frame, my suggestion would be to use the functions purrr::map_dfr and fs::dir_ls. The files will need to be in the same format for this to work.
Put the files in their own folder, then do
list_of_files <- dir_ls(folder_name)
list_of_files |>
map_dfr(read_csv, .id = 'school_name')
This will return an appended data frame with the file names added as a column called 'school_name'. You could then use regular expressions to extract the school name from the file name.

How to Merge row into row in Gridview

How can I Achieve this table.
From:
TIME
DETAILS1
DETAILS2
DETAILS3
8:00
test a
test a1
test a2
8:00
test b
test b1
test b2
8:00
test c
text c1
test c2
To:
TIME
DETAILS1
DETAILS2
DETAILS3
8:00
test a
test b
test c
test a1
test b1
test c1
test a2
text b2
test c2
Since you're using Microsoft Access, it's easier to solve this with SQL, and use this query as the datasource for your DataTable or similar class in ASP.NET later.
You also didn't provide your database structure, so I considered it being a single table named TableTime with columns ID, Time, Details1, Details2, and Details3.
This solution basically creates a ranked column (Rank) 'grouped' by the Time. So for each different Time, you'll get the related rows with 1, 2, 3, and so on. And the row with Rank equals 1 is the one you want to display the corresponding time. Every row with Rank greater than 1 keeps the Time empty, creating your desired effect.
You'll probably need to adapt this for your table and column names, but if you need help with that please share your table structure.
SELECT
IIf([Rank]=1,[TimeTable].[Time],"") AS MyTime,
TimeTable.Details1,
TimeTable.Details2,
TimeTable.Details3,
DCount("ID","TimeTable","Time = #" & [TimeTable].[Time] & "# AND ID <=" & [TimeTable].[ID]) AS Rank
FROM TimeTable;

What type of encryption could be used by this smart bulb?

I want to write an app that can control my smart bulb. I've captured the bluetooth dump that the bulb's official app is sending.
I found that the data is encrypted, i sent the same command several times and the output was always different, of course the bulb did the same thing each time.
There are some examples below for reference. First 3 bytes are not important (they just increment), the remaining 17 bytes are my struggle.
080000 e6 12 f2 2c 8e 11 56 f2 4e 68 92 ad 2b 40 bd 0c d5
0a0000 e2 72 9d ec 04 aa 27 1b c6 91 4b c2 a1 a1 1d 58 c5
0c0000 06 ce 72 cf f5 c3 d7 03 e5 10 2f b3 f0 34 03 b8 53
Question 1: What kind of encrypting technique does this:
one input at sender side => several different outputs
the reciever calculates one specific result from several different inputs.
Note that the reciever in this case is a smart bulb with a probably not too sophisticated chip.
Question 2: Could it be that the input is encrypted using the actual time? The time is sent in each packet, so maybe that's how the values are always different, but still the other side can figure out the original values using the recieved time?
Typically encryption adds a random element that is sent with the message so each message is different in order to prevent replay attacks, such as you are interested in.
Given that the encrypted message is 20 bytes my guess might be CTR mode. Potential algorithms might range from AES to XTEA. But knowing the encryption methods will nit help if the bulb company did their cryptography correctly.
Nota Bene: Cryptographic security relies solely on the key being secret, not the method.

How to fill field data by checking condition in crystal report?

Consider the below records which retrieved from database,
My xsd datatable fields are,
categoryName
categoryType
prize
Datatable records
category name - category type - prize
--------------------------------------
c1 - 1 - 10
c2 - 1 - 20
c3 - 2 - 10
c4 - 2 - 10
c5 - 1 - 30
c6 - 2 - 30
c7 - 1 - 10
c7 - 2 - 10
Expected report output to be in report as given below,
summary of category
category name - pize | category name - prize
c1 - 10 | c3 - 10
c2 - 20 | c4 - 10
c5 - 30 | c6 - 30
c7 - 10 | c7 - 10
|
Total type1 | Total type2
prize - 70 | prize - 60
Grand total - 130
please help anyone how to achieve this?
Create 2 subreports. Put them side-by-side outside the details section. For example, in the page header. Make the layout (category name and prize columns).
Change the subreport links. The one to the left shall be filtered by type1. The one to the right shall be filtered by type2.
In another section below (may be the page footer), put the two running total fields side-by-side. One of them shall summarize by type1 and the other by type2.
Add another section below and put the grand total.
No need of sub report instead use the cross tab in main report and take first column as type and second as category and for summation part take price you will get required output

Resources