I can now obtain gm values of each individual mosfets using built-in ngspice command
1) For your test circuit, I am still a little bit confused on the need for connecting the output node of DUT circuit to the E1/E2 input terminal ? since the other input terminal is a fixed voltage source, this looks like a voltage comparator to me ?
2) What is the purpose of E1/E2 in transconductance measurement ? simply acting as a voltage gain ?
3) And is there really a need for the current source (which also connects with the output node of DUT) in the test circuit ?
In other words, it "seems" to me that the test circuit connection with the DUT does not correctly reflect the test measurement definition of transconductance which is delta[Iout]/delta[Vin]
Feel free to correct my statements though.